Skip to content

fix(user-context): stop every page crashing on the streamed profile promise - #102

Merged
chriskehayias merged 1 commit into
mainfrom
fix/user-context-flight-promise
Sep 29, 2026
Merged

chriskehayias merged 1 commit into
mainfrom
fix/user-context-flight-promise

Conversation

@chriskehayias

Copy link
Copy Markdown
Contributor

Summary

  • Bug: after sign-in, every page in the (web) shell fell through to the root error boundary with An unsupported type was passed to use(): undefined.
  • Cause: the profile promise ServerProviders streams to the client arrives as React Flight's ReactPromise, whose then() returns undefined. UserProvider called profilePromise.catch(...), which therefore returned undefined, and useUser() passed that to use().
  • Fix: settle the promise with await inside an async helper (settleProfile), which relies only on then() invoking its callbacks. A failed load still degrades to null and logs user.profile.load_failed.
  • Also adds .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() returns undefined), covering both resolve and reject. They fail without the fix.

Test plan

  • npx vitest run --coverage: 2034 passed / 3 skipped, coverage thresholds met
  • npm run lint and npx tsc --noEmit clean
  • Manual Playwright pass against the dev server: sign-in, home, header avatar and user menu, sidebar, contact search (including special characters), contact details and logs, add/edit/delete dialogs opened and cancelled (no MP writes), error boundaries, status pages, 404, phone width, sign-out

🤖 Generated with Claude Code

…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

codecov Bot commented Sep 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chriskehayias
chriskehayias merged commit 7342517 into main Sep 29, 2026
5 checks passed
@chriskehayias
chriskehayias deleted the fix/user-context-flight-promise branch September 29, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant