Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a custom visual where the console clears after update. This makes troubleshooting difficult. Is there a way to turn this off? I know that I can persist the log in dev tools, but I can't expand any objects written to the console.
It appears to be specific to this visual. I checked another visual and the console persists as expected. I searched all of my files and did not find an instance of console.clear().
---------
Update 1
I've narrowed it down to the clear method for my ISelectionManager object. When I comment out the following line, the console no longer tries to clear. This did not used to happen, so I'm not sure what has changed.
this.selectionManager.clear();
---------
Below is what comes up when I click the debugger next to the message indicating that the console was cleared.
var l = function() {
function t(n) {
! function(t, n) {
if (!(t instanceof n)) throw new TypeError("Cannot call a class as a function")
}(this, t), this._host = n.host;
var e = n.element.offsetWidth,
i = n.element.offsetHeight;
this._tooltipServiceWrapper = r.a(this._host.tooltipService, Object(a.a)("body").node()), this._rootElement = Object(a.a)(n.element).append("svg").attr("width", e).attr("height", i), this._updateOptions = null
}
var n, e, l;
return n = t, (e = [{
key: "update",
value: function(t) {
try {
if (console.clear(), this._updateOptions = t, this._rootElement.attr("width", t.viewport.width).attr("height", t.viewport.height).selectAll("*").remove(), this._viewModel = u.a.visualTransform(t, this._host), !this._viewModel || 0 != this._viewModel.dataConformanceType) return void(this._viewModel.settings.dataRules.suppress || this.showDataNonConformanceMessage(this._rootElement, i.a[this._viewModel.dataConformanceType]));
new o.a({
host: this._host,
viewModel: this._viewModel,
parent: this._rootElement,
width: t.viewport.width,
height: t.viewport.height,
tooltipService: this._host.tooltipService
})
} catch (t) {
console.error(t)
}
}
},
Solved! Go to Solution.
Hi @giammariam
Console.
For reference: Console.Clear Method
Please try ways as below to solve your problem.
First, you can write a extension which executes a javascript on page load and assigns empty function to console.clear. So, it doesn't throw any error if its called.
console.clear = () => {}
References for building extension to run on page load Chrome Extension: Make it run every page load https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Modify_a_web_page
Secondly, you can load the page once and open devtools and goto sources and search for console.clear
and add breakpoints every where its called and reload the page. The code execution will stop when the console.clear is called for the first time and again you can goto console and assign console.clear with empty function and override.
Reference for Using BreakPoints in Firefox https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Set_a_breakpoint
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @giammariam
Console.
For reference: Console.Clear Method
Please try ways as below to solve your problem.
First, you can write a extension which executes a javascript on page load and assigns empty function to console.clear. So, it doesn't throw any error if its called.
console.clear = () => {}
References for building extension to run on page load Chrome Extension: Make it run every page load https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Modify_a_web_page
Secondly, you can load the page once and open devtools and goto sources and search for console.clear
and add breakpoints every where its called and reload the page. The code execution will stop when the console.clear is called for the first time and again you can goto console and assign console.clear with empty function and override.
Reference for Using BreakPoints in Firefox https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Set_a_breakpoint
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.