githubnext/chopinPublic

Let's compose rich plans together

Recover from rapid document switches

A route that became ready while another was still leaving turned the
never-shown current route into the leaving one. Its layer had already
counted its close as reported before it had a listener, so the swap
never finished and the workspace stayed blank. The reducer now drops a
never-shown route, and ContentSwapLayer only counts a close as reported
once a listener has run.

The sync hold is now capped at 200ms from the request, waits on the
requested surface (the child for child routes), and the route timing
lives in the motion contract.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
C5MAMaggie Appleton and Claude Opus 5.5 authored
9e0c781Patch
Parent502a4d6
8 files changed+100-23
StackedSplit
apps/web/src/document-route-swap.test.ts+19 โˆ’7
apps/web/src/document-route-swap.ts+5 โˆ’5
apps/web/src/document-workspace-host.tsx+9 โˆ’4
apps/web/src/hosted.tsx+1 โˆ’2
apps/web/src/motion-contract.test.ts+5 โˆ’0
apps/web/src/motion-contract.ts+9 โˆ’1
e2e/document-navigation.e2e.ts+46 โˆ’0
packages/editor/src/content-swap.tsx+6 โˆ’4