Repository navigation
fix(user-context): stop every page crashing on the streamed profile promise - #102
Merged
Merged
Conversation
…romise The profile promise ServerProviders streams to the client arrives as React Flight's ReactPromise, whose then() returns undefined instead of a new promise. UserProvider called profilePromise.catch(...), which therefore returned undefined, so useUser() hit use(undefined) and every signed-in page fell through to the root error boundary. Unit tests missed it because they passed native Promises. Settle the promise with await in an async helper, which only relies on then() invoking its callbacks. Add tests with a Flight-shaped promise for both the resolve and reject paths; they fail without the fix. Also ignore .playwright-mcp/: its snapshots and console logs capture real MP member data. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
(web)shell fell through to the root error boundary withAn unsupported type was passed to use(): undefined.ServerProvidersstreams to the client arrives as React Flight'sReactPromise, whosethen()returnsundefined.UserProvidercalledprofilePromise.catch(...), which therefore returnedundefined, anduseUser()passed that touse().awaitinside an async helper (settleProfile), which relies only onthen()invoking its callbacks. A failed load still degrades tonulland logsuser.profile.load_failed..playwright-mcp/to.gitignore, since its snapshots and console logs capture real MP member data.Why the tests missed it
Existing tests passed native Promises, whose
.catch()returns a new promise. The two new tests build a Flight-shaped promise (then()returnsundefined), covering both resolve and reject. They fail without the fix.Test plan
npx vitest run --coverage: 2034 passed / 3 skipped, coverage thresholds metnpm run lintandnpx tsc --noEmitclean🤖 Generated with Claude Code