Add client-side handling for server-side errors using `errorComponent` and `wrapInSuspense: true`
Addresses issue #968 fixing error handling during SSR
This pull request adds:
- The ability for server errors to be handled via
errorComponentwhilewrapInSuspense: true - Router options
serializeErroranddeserializeError(with sensible defaults) that allows an end-user to decide what parts of an error to forward from the server to the client /errorpages on the SSR examples
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:
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.
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
please rebase so that we can merge this