Skip to content

feat(workbench,ui): matched-geometry view transition on session switch - #299

Merged
lucas77778 merged 4 commits into
masterfrom
xuan/code-457
Jul 29, 2026
Merged

feat(workbench,ui): matched-geometry view transition on session switch#299
lucas77778 merged 4 commits into
masterfrom
xuan/code-457

Conversation

@AprilNEA

Copy link
Copy Markdown
Member

Summary

Apple-grade UI Details batch 3: clicking a thread row now runs the switch inside a same-document View Transition — the row's title travels continuously to the conversation header instead of the content snapping (Chromium 148 native API, no library).

  • applySessionSwitchTransition (packages/client/workbench/src/surface/session-switch-transition.ts) wraps the sidebar's select path: capability check, reduce-motion gate (appearance store), and a plain-apply fallback when the clicked row isn't in the DOM (palette selection of an off-screen thread, history traversal).
  • Pair naming is transient by design: only the switching pair ever carries view-transition-name — the clicked row's title (data-thread-title, cleared inside the update callback) in the old snapshot, the header title (data-conversation-title, cleared on finished) in the new one. A duplicate name in either snapshot would make the browser silently skip the whole transition, which is also why the sidebar's N rows are never statically named.
  • The React commit inside the update callback is flushSync (suppressed lint with reason: the browser captures the new snapshot when the callback returns).
  • Targets marked in both shells: desktop chrome's MainChromeTitle and the shared default TitleStrip (webview gets the transition for free; non-Chromium browsers fall back via the capability check).
  • Timing rides the motion scale: ::view-transition-group(thread-title) and the root crossfade at --motion-normal (250ms).

Verification

  • 5 unit tests on the pairing lifecycle (fallbacks ×3, name set/clear around the update, stale-name cleanup on interruption) — jsdom lacks the API, so the VT object is stubbed; the store import is factory-mocked to keep the @linkcode/ui barrel (dnd-kit/ResizeObserver) out of the graph.
  • Boot smoke against the built desktop app: workbench renders, prior corner-shape assertions stay green.
  • pnpm check:ci + pnpm test (1944 passed) green.
  • The hand-feel itself needs manual acceptance on a machine with ≥2 threads — switch back and forth, rapid-fire clicks (interruption), and reduce-motion on/off.

Closes CODE-457

@linear-code

linear-code Bot commented Jul 27, 2026

Copy link
Copy Markdown

CODE-457

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 245bcf36ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/client/workbench/src/surface/session-switch-transition.ts
@lucas77778
lucas77778 self-requested a review July 29, 2026 11:42
@lucas77778
lucas77778 merged commit f763ea6 into master Jul 29, 2026
8 of 9 checks passed
@lucas77778
lucas77778 deleted the xuan/code-457 branch July 29, 2026 12:09
AprilNEA added a commit that referenced this pull request Jul 29, 2026
#313)

## Summary

Replaces the imperative View Transition stopgap that #299 shipped
(manual `startViewTransition`, generation guard, DOM name pairing) with
React's official `<ViewTransition>` component, per the decision to allow
the canary channel. Four commits:

1. **`chore(deps)`** — catalog react/react-dom →
`19.3.0-canary-96fcba90-20260728` (web/desktop renderers only; mobile
pins its own react — the stale catalog comment claiming otherwise is
fixed). The canary export is **unprefixed** `ViewTransition`
(stable-track; canary is the channel Next.js ships in production).
`minimumReleaseAgeExclude` entries added; drop back to latest once 19.3
goes stable.
2. **`refactor(workbench,ui,desktop)`** — the declarative rewrite,
shaped by two source-verified facts:
- **Pairing is strictly mount/unmount-based** (react-dom's appearing-map
× deletions walk — a persisting boundary never pairs). So the row
title's boundary *unmounts when its row becomes active* (a plain span
takes over, visually seamless) while the header's boundary remounts
keyed by session — giving forward *and* return flights for free.
- **zustand rides `useSyncExternalStore`, which never enters a
transition lane** — `startTransition` around a store write does nothing.
One `useDeferredValue(selectedId)` in `useWorkbenchSessions` bridges the
render path into the lane (a documented ViewTransition trigger), and
puts the row unmount + header mount in the same deferred commit, which
the pairing requires.
- `@linkcode/ui` gains a typed named re-export via an in-module `declare
module 'react'` augmentation (@types/react tracks stable). The whole
stopgap module + its 7 unit tests are deleted; interruption/coalescing
is now React's own.
3. **`fix(assets)`** — drive-by: the committed pi closure manifest was
stale since the ws 7→8 bump (#289) nested `ws@8.21.0` copies under the
pi closure; `closure.test.ts` was already red on master. Regenerated.
4. **`refactor(webview)`** — extends the boundary to the web shell's
title (the render point #299's follow-up commit 8e5b485 covered with
the now-removed data attribute).

Motion pacing moves to `::view-transition-group(*)` on
`--motion-normal`; the app-level reduce-motion preference silences
snapshot animations via CSS (the root-attached pseudos are out of reach
of the `.reduce-motion *` reset).

## Verification

- Drive probe against the built desktop app (isolated daemon + two real
pi threads): 4 sidebar switches → 3 `document.startViewTransition`
invocations (the rapid double-fire coalesced by React), zero console
errors.
- react-dom canary pairing semantics read from the installed production
build, not guessed.
- `biome` / `eslint` (serial — the concurrency OOM is CODE-468) / `tsc`
green; full vitest suite 2056 passed, including the previously-red
closure test.
- Hand-feel needs the usual manual pass (switch, rapid clicks,
reduce-motion on/off).

Closes CODE-469
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