Repository navigation
fix(chat): keep composer drafts across hydration - #8892
Conversation
- Adopt text typed into the server-rendered composer before hydration; the dropped input event left state empty and the next render wiped the text - Restore a saved draft after hydration instead of in the initial render, which mismatched the server HTML and regenerated the composer on every reload with a draft - Share one useHydrated hook across the composer, organization home, and theme toggle - Mobile E2E: wait for the draft to overflow its editor instead of measuring once, and check a saved draft returns after a reload without a hydration error
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 7 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
No issues found across 7 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
Turn on auto-fix | Re-trigger cubic
Summary
e2e (mobile)intermittently faildraft scroll boundarieson WebKit (The long draft must have a scrollable editor/The draft must overflow its editor): the fill landed before the composer hydrated and the draft disappearedlocalStorageduring hydration mismatched the server HTML, so every reload with a saved new-chat draft raised a hydration error and regenerated the composeruseHydratedhook replaces three private copies (composer, organization home, landing theme toggle)Type of Change
Testing
use-prompt-editor.test.tsx: new jsdom test hydrates server HTML with text typed before hydration (red before the fix)next dev: 20 consecutive runs, 0 failed checks; before the fix 7/20 failed with the reload hydration error. The new reload check fails on the pre-fix composer. Full suite (Chromium + WebKit, all viewports) 186/186bun run lint,bun run type-check,bun run check:audits,bun run test, block registry checkChecklist
test-auditauthoring gate)