fix(render): new ErrorBoundary breaking rendering in server components #2871
+10
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We were getting this error at https://react.email when rendering components because the new
ErrorBoundaryapproach to avoid client side rendering fallback was using React class components, which doesn't work in Server ComponentsWe could define a separate export for
react-server, but it also so happensReact.Componentis undefined in server environments, and we can just check for that.Summary by cubic
Fixes server component rendering by making ErrorBoundary safe in React Server Components. Adds a guard for React.Component and falls back to a pass-through boundary so pages render without crashing.
Written for commit 423dd5e. Summary will update on new commits.