Skip to content

(MOT-4518) feat(console): replay workspace writes made before hydration - #861

Merged
rohitg00 merged 1 commit into
feat/console-deeplink-beside-chatfrom
feat/console-hydration-gate
Aug 21, 2026
Merged

(MOT-4518) feat(console): replay workspace writes made before hydration#861
rohitg00 merged 1 commit into
feat/console-deeplink-beside-chatfrom
feat/console-hydration-gate

Conversation

@rohitg00

Copy link
Copy Markdown
Contributor

Why

useWorkspaceTabs hands out the localStorage copy of the layout before the first server answer arrives, then swaps to the server layout. A mutation in that window — a workspace.create keyboard shortcut, a worker's panel-open, a tab click — writes against the local copy and is discarded when the server value lands. #843 guarded the two hash effects with a layoutSource flag, but the hook still let every other consumer mutate the soon-to-be-replaced copy.

What

The hook now holds a pre-hydration write and replays it. While layoutSource === 'pending', persist records the intended { tabs, activeTabId } and updates the local view for immediate paint, but does not commit. When the source leaves pending (server hydrated, or known unavailable), an effect flushes the held write through the normal persist path — a server read-modify-write when the configuration worker is reachable, localStorage otherwise. The flush decision is a pure shouldFlushPendingWrite(source, hasPending) with its own test.

The per-effect layoutSource guards in App.tsx are left in place; this change is additive and covers the consumers those guards do not (shortcuts, panel-open, TabStrip), without touching the hash state machine.

Verification

  • tsc -b, biome, vitest 1470 (new: shouldFlushPendingWrite truth table).

Stacked on #860#843. Merge those first.

Linear: MOT-4518

@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview Aug 20, 2026 4:19pm
workers-tech-spec Ready Ready Preview Aug 20, 2026 4:19pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c69a1289-248d-4449-a4ec-dd9798d88886

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 62 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@rohitg00
rohitg00 merged commit bde886c into feat/console-deeplink-beside-chat Aug 21, 2026
17 checks passed
@rohitg00
rohitg00 deleted the feat/console-hydration-gate branch August 21, 2026 09:15
rohitg00 added a commit that referenced this pull request Aug 21, 2026
* feat(console): deep-link opens a screen beside chat, not a bare tab

* (MOT-4518) feat(console): replay workspace writes made before hydration (#861)

* (MOT-4517) test(console): pin replay-vs-deep-link write ordering

The review's race was real on the pre-merge branch, where the pending layout
replay went through an unserialized whole-configuration write and could
interleave with a deep link's openScreen. The merge already routes both
through the serialized writer as transforms; this pins that contract: both
orders keep both intents, and several pre-hydration writes compose instead
of last-snapshot-wins. The workspace transform seam is exported for the
test.
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.

2 participants