-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Describe the feature you'd love to see
When using componentDidCatch, users might forget to run this.setState to set a new state. In this case, preact will throw an error at process function and fail to set process._rerenderCount = 0, which will prevent future enqueueRender working properly.
I have created two example cases: Preact, React. In this example, when we click the counter up to 3, it will throw an error, and the parent error boundary will not setState in their componentDidCatch.
For React, it will remind user to call setState properly, see their impl at here:
For Preact, it will sliently break and the page will be not interactivable any more.
So I would suggest we can add an error message on this circumstances. I'd be happy to submit a PR to support this; please let me know if you have any suggestion or concerns.
Additional context (optional)
N/A