Repository navigation
Make the shipping error boundary render its fallback - #637
Merged
addyosmani merged 1 commit intoOct 10, 2026
Merged
Conversation
Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
addyosmani
approved these changes
Oct 10, 2026
addyosmani
left a comment
Owner
There was a problem hiding this comment.
praise: I rendered the sample as written and it throws on every render, even with a healthy child, because state is never initialised, and without getDerivedStateFromError the fallback can never show. This is the canonical fix. Merging.
suggestion (non-blocking): the class is still an untyped React.Component, so strict TypeScript flags this.props.children. Typing the props would make the sample copy-paste clean, if you want a follow-up.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem and change
The shipping skill’s error-boundary example reads
this.state.hasErrorwithout initializing state, so it crashes even when its children are healthy. It also has nogetDerivedStateFromError, leavingcomponentDidCatchto report the error without selecting the fallback.Initialize the state and implement the fallback lifecycle, following React’s error-boundary contract. The reporting fields and retry callback remain intact.
Reproduction
I extracted the exact TypeScript/JSX example, transpiled it, and mounted it with React 19.2.0, ReactDOM 19.2.0 and jsdom. Before the change, both controls fail with
Cannot read properties of null (reading 'hasError'). After the change:Dropping the new lifecycle method makes the failing-child control fail again. This is a DOM runtime check, not a browser-engine test or a paid model-behavior evaluation.
Verification
AI assistance: OpenAI Codex / GPT-6 was used for investigation and the patch.