Error handling for unmounted component
See original GitHub issueWhen a component is unmounted, error observer is removed from the query (in graphql wrapper component function componentWillUnmount
). Thus, if an “in flight” request arrives with an error, there is no way to catch it and avoid the console.error
red box message “Unhandled error …”.
At least the error message should explain what’s really happening (unmounting could keep an error observer subscribed to adapt the error message to this case).
The error message could also be removed or only be a console.warn
.
An option could be added to the graphql
function to specify an error observer for errors after unmounting the wrapped component.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:14 (8 by maintainers)
Top Results From Across the Web
Can't perform a React state update on an unmounted ...
and then I was trying to show a message with this.setState({succ_message: "...") in my component. Component was looking empty with the same ...
Read more >Fixing React's “Called SetState() on an ... - How-To Geek
Seeing Called setState() on an Unmounted Component in your console is one of the most frequent issues faced by newcomers to React.
Read more >React: Prevent state updates on unmounted components
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your...
Read more >Avoid React state update warnings on unmounted components
React raising a warning when you try to perform a state update on an unmounted component. React setState is used to update the...
Read more >React state update on an unmounted component - debuggr.io
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I made a reproduction with the error template It reproduces a component throwing an unhandled network error when unmounting and not updating after an error (related to #2513)
An unhandled network error when unmounting a component that failed to fetch
this in particular is killing Apollo for me. The docs suggest logging the user out on a 401 error. Logging out often means unmounting scenes. This results in an unhandled error. So the docs are contradicted by how the client behaves.