Repository navigation
improve(ui): avoid redundant work when toggling mobile navigation - #190027
Conversation
Keep drawer state synchronous but publish its own revision so a toggle updates drawer bindings without rebuilding the shell snapshot, republishing unrelated sidebar props, or replaying shell lifecycle work. Preserve focus, inertness, native scrim, and the current sheet spring. Add single-activation benchmark cases beside the compound cycle.
Force the scrolling token off with toggle so an already-stopped label does not rewrite its class attribute when drawer visibility changes. Keep active animation cancellation unchanged and cover repeated visibility and size notifications.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR isolates mobile drawer updates from full-shell updates and prevents redundant class mutations on stopped marquee labels. Example: Open mobile navigation at 390×844 with 1,000 sidebar sessions.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR removes verified redundant UI work while preserving drawer behavior; no actionable correctness or security findings remain. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI shell consumes navigation and application state, renders the drawer and retained conversation, and acknowledges committed DOM before focus handling continues. flowchart TD
A[Navigation input] --> B[Shell presentation owner]
B --> C[Navigation revision]
C --> D[Reactive drawer bindings]
D --> E[Committed presentation]
E --> F[Sidebar and browser chrome]
E --> G[Focus continuation]
Technical reviewBest possible solution: Retain the focused drawer publication path within the existing shell owner and the idempotent marquee class update. Do we have a high-confidence way to reproduce the issue? Current-main source shows drawer writes invalidating the full shell and stopped marquees removing an already-absent class; supplied browser measurements corroborate the redundant mutations. Is this the best way to solve the issue? The change addresses both producers of redundant work using existing owners, preserves full invalidation when needed, and leaves animation and focus contracts intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 31866655fd60. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +60, Tests +50, Docs +7, Other +41. Total +158 across 9 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 31, 2026, 11:42 PM ET / November 1, 2026, 03:42 UTC. |
|
Merged via squash.
|
…enclaw#190027) * perf(ui): isolate mobile sidebar toggle commits Keep drawer state synchronous but publish its own revision so a toggle updates drawer bindings without rebuilding the shell snapshot, republishing unrelated sidebar props, or replaying shell lifecycle work. Preserve focus, inertness, native scrim, and the current sheet spring. Add single-activation benchmark cases beside the compound cycle. * perf(ui): leave stopped marquee classes untouched Force the scrolling token off with toggle so an already-stopped label does not rewrite its class attribute when drawer visibility changes. Keep active animation cancellation unchanged and cover repeated visibility and size notifications. * fix(test): preserve typed sidebar benchmark overrides
What Problem This Solves
Opening or closing mobile navigation rebuilds the full shell view and republishes unrelated sidebar properties. Delayed label measurements also rewrite the class of an already-stopped marquee.
User Impact
Mobile navigation retains its existing sheet animation, selected conversation, focus behavior, and layout while doing less work per toggle.
Why This Change Was Made
The reported compound sidebar regression crossed the intentional 441 ms sheet-spring change in #188162. The benchmark waits for closing motion before delivering its second input. History and traces ruled out the later desktop geometry changes as its cause; Chromium had zero layout passes through the measured cycle.
The existing shell owner now publishes drawer changes separately. Its existing view supplies reactive drawer bindings and the commit acknowledgement; a simultaneous full-shell invalidation still takes the full path. Stopped marquees use a forced class toggle, which leaves the class attribute untouched when the scrolling token is already absent. The benchmark gains independent mobile open/close cases alongside the retained compound cycle.
Evidence
The retained spring keeps wall time essentially flat (all median movements within 0.21%; p95 movement below 0.1%). The compound target of 358 ms is not reached: its mandatory exit-animation wait remains. Single activations all meet 358 ms on the candidate. The reduction in the DOM span removes late no-op mutations; it is not a claim that the visible spring paints faster.
Chromium thread task CPU, median / p95 (ms):
Total CPU is essentially flat for the compound action; atomic open/close medians improve about 3%. The open script-CPU decrease also appears in the A/A control, so it does not establish a broad CPU win. Final diagnostic traces show no per-frame layout loop: Chromium has zero layouts; WebKit retains 5/7/12 layouts for open/close/cycle, totaling under 1.5 ms each. The separate drawer commit path is exercised. WebKit close retains the existing composer-width measurement tail. Native mutations fall 34→31 for Chromium open/close and 70→63 for its cycle; WebKit falls 34→31, 46→43 and 81→75. Chromium has zero measured layout passes throughout. Host load was 6.35–17.58.
Controlled workload: production bundles, synthetic 1,000-session sidebar, 390×844, Chromium and WebKit, localhost, ten serial interleaved base/head/base-control triplets per action. Input-to-commit measures first native input to last observed DOM mutation, not paint latency. WebKit Inspector intervals are elapsed time; Chromium task/script counters are thread CPU. The current spring remains 441 ms.
pnpm tsgo:uipassedSynthetic data only. Both inspected before/after pairs are byte-for-byte identical.
Production LOC: 2,082 → 2,142. All touched files: 4,435 → 4,593 (+215/−57). The growth is the separate drawer publication/commit path, reactive getters, two regression cases, and single-action benchmark coverage. No added effects, native listeners, DOM queries, owner-restoration calls, or manual component loading.
The production bundle was built from the final UI source. All five changed production modules in its source maps match
2273c9a384050e3d5482de2fc5be763f310ea96eexactly and are unchanged at6fb6dae1e2550741f8aa0e8498612f80674b09fe. The first CI run caughtno-map-spreadin the new benchmark cases; the correction uses a freshObject.assigntarget with typed overrides, preserving scenario behavior. Targeted scripts lint, scripts typecheck, and incremental independent review passed before the correction push.