You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On this line, if debug is set to the default value false, this line will clear all console messages prior to the point the Panel component is mounted.
As a result, some user-defined console messages in e.g. src/main.js will be ignored. This is quite unexpected and should be removed or at least substituted as a separate prop.
For example, we can add a clearConsole as a prop, with a default value false, and change the line to if (this.clearConsole) console.clear();
The text was updated successfully, but these errors were encountered:
Good point! Would you be against <Panel keep-console />? The reason I personally like the default behavior is that it refreshes and resets the console on hot reload or refreshing. Many components also have a hidden debug prop which logs additional information on changes inside the component which, when set would also remove the console.clear. I'll be doing some updates to components today and will put this prop in unless I hear otherwise
I can see why you prefer clearing the console by default.
However, I would like to say that keep-console does not sound like a good idea to me.
In my case, I wrote a buggy line that executed before Panel is mounted. It threw an error, but I couldn't see the error in the console.
I later realized the bug and changed to <Panel debug />. It does print some extra debugging lines, but all I did is simply ignored them. So adding a keep-console does not add more to the current debug prop.
Besides, although clearing the console can reset the console on hot reload or refreshing, as a default behavior it should be called immediately after javascript is loaded, so that no errors will be ignored.
One solution to this problem may be using console.debug instead of console.log, so you can debug the UI components while users will not see these logs in console by default.
On this line, if
debug
is set to the default valuefalse
, this line will clear all console messages prior to the point the Panel component is mounted.As a result, some user-defined console messages in e.g.
src/main.js
will be ignored. This is quite unexpected and should be removed or at least substituted as a separate prop.For example, we can add a
clearConsole
as a prop, with a default valuefalse
, and change the line toif (this.clearConsole) console.clear();
The text was updated successfully, but these errors were encountered: