router icon indicating copy to clipboard operation
router copied to clipboard

Add client-side handling for server-side errors using `errorComponent` and `wrapInSuspense: true`

Open giilbert opened this issue 1 year ago • 3 comments

Addresses issue #968 fixing error handling during SSR

This pull request adds:

  • The ability for server errors to be handled via errorComponent while wrapInSuspense: true
  • Router options serializeError and deserializeError (with sensible defaults) that allows an end-user to decide what parts of an error to forward from the server to the client
  • /error pages on the SSR examples

giilbert avatar Jan 15 '24 19:01 giilbert

This fixes error handling... but only for non-defered promises. I just noticed that it doesn't fix it for defered promises. Looking into it now... :sob:

giilbert avatar Jan 15 '24 19:01 giilbert

Error handling in (streaming) SSR seems to work! but the API and documentation need some more work. I'm not 200% sure if I did everything correctly - please give me some feedback, I'm gonna call it a day.

giilbert avatar Jan 16 '24 03:01 giilbert

Should the ResolvedSuspenseBoundary automatically resolve to a <Suspense>, if the route has has a loader and it's being rendered on the server, instead of manually setting wrapInSuspense: true?

I tried looking into the way that Remix handles their ErrorBoundary on SSR, but I could not figure it out myself

SamiHonkasalo avatar Jan 16 '24 14:01 SamiHonkasalo

please rebase so that we can merge this

schiller-manuel avatar Jan 18 '24 22:01 schiller-manuel