-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preact 10 more difficult to debug uncaught errors than Preact 8. #2323
Comments
We need some form of exception catching in core in order to support componentDidCatch, but perhaps there's a way to make it conditional on the existence of a FWIW as a short-term fix, if you check the "Pause on caught exceptions" box, the debugger will pause in the same place it used to in 8.x (and then again where you noted it pausing in 10, though you can blackbox |
React avoids caught exception issues in debug with its I would be interested in either a built-in solution, or some way that I could provide my own sort of
The existence check on |
Interesting - we have a hook called |
Maybe for dev mode you can use setTimeout at the beginning and clearTimeout at the end of critical section. So if timeout is cleared - no error has occurred. If timeout is triggered - you invoke componentDidCatch. |
Recently giving Preact 10 a try after using Preact 8 for a very long time, but having massive difficulties working with it cause of the inability to properly debug with it.
Let's say I had something like the following:
In Preact 8, this will happen:
In Preact 10, this will happen:
In Preact 8, it's super easy to see what went wrong, and to inspect variables and try out different snippets of code to try and fix the issue. In Preact 10 because of the
try/catch
for supportingcomponentDidCatch
, I can't do that anymore, making it really frustrating to identify the issue and solve it, especially when usingeval
source maps where you can't often can't use the stack trace to click on the relevant line.Is there any way to resolve this? Can Preact's code be re-organised so that there's no try/catch if there's no
componentDidCatch
in the component tree? This issue can make fixing code fairly time consuming so would appreciate any thoughts you have.Thanks! 🙂
The text was updated successfully, but these errors were encountered: