Skip to content

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

Open
AprilNEA wants to merge 1 commit into
masterfrom
xuan/code-457
Open

feat(workbench,ui): matched-geometry view transition on session switch#299
AprilNEA wants to merge 1 commit 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".

}
headerTitle()?.style.removeProperty('view-transition-name');
source.style.setProperty('view-transition-name', PAIR_NAME);
const transition = document.startViewTransition(() => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Serialize overlapping session-switch transitions

When two session selections occur before the first View Transition update callback runs, both calls retain the same rendered currentLocation, leave multiple source titles temporarily named thread-title, and queue separate apply callbacks. This can make Chromium skip the matched transition because the old snapshot has duplicate names, while navigation history records the stale origin twice so Back skips the intermediate thread. Rapid consecutive clicks or shortcut/palette selections can trigger this; cancel or serialize the pending switch and ensure history is recorded with the selection that actually applies.

Useful? React with 👍 / 👎.

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