Skip to content
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

Render error handling gone with v4 #3082

Closed
1 task done
oliviertassinari opened this issue Oct 13, 2017 · 7 comments
Closed
1 task done

Render error handling gone with v4 #3082

oliviertassinari opened this issue Oct 13, 2017 · 7 comments

Comments

@oliviertassinari
Copy link
Contributor

oliviertassinari commented Oct 13, 2017

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

An error page is shown when the react rendering tree throw an error in production

Current Behavior

A blank page is shown when the react rendering tree throw an error in production

Steps to Reproduce (for bugs)

  1. Render a page server side with no errors
  2. Render a page client side with no errors
  3. Navigate to a page that throw inside the render method.

Context

I'm not 100% sure, but I think that such logic was present with v3.
It could have been removed with d19cc97#diff-1858c8296dd2b642c74271609cf701e7L40.

Your Environment

Tech Version
next v4.0.2
node v8.1.4
OS MacOs
browser Chrome
@advany
Copy link

advany commented Oct 13, 2017

1

@oliviertassinari
Copy link
Contributor Author

At least, I'm pretty happy with the new error mechanism of react@16: componentDidCatch. I do no longer have to hook into react internals to report exceptions to our log service.

@damusnet
Copy link
Contributor

@oliviertassinari Hi, do you know if componentDidCatch is supposed to work on the server? It works fine for me on the client, but if I refresh the page where there is an error, triggering server side rendering, the app comes back with a Next.js 500 instead of catching it and displaying my custom message. It kind of defeats the purpose of error boundaries :-/

@damusnet
Copy link
Contributor

Nevermind, found my answer: facebook/react#10442

No componentDidCatch for SSR for now :(

@oliviertassinari
Copy link
Contributor Author

@damusnet I didn't know about it. I need to give it as second look!

@ex3ndr
Copy link
Contributor

ex3ndr commented Mar 9, 2018

Unfortunately there are no simple way to catch exception during SSR and our pages can be easily stuck at loading forever.

@zekchan
Copy link
Contributor

zekchan commented Apr 20, 2018

@ex3ndr actually there are. I coded simple component https://github.com/zekchan/react-ssr-error-boundary

@lock lock bot locked as resolved and limited conversation to collaborators Apr 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants