Repository navigation
fix(web): switching threads no longer re-renders unaffected sidebar rows - #47105
Conversation
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — The sidebar now keeps thread-click and settle callbacks stable while calling their latest committed implementations, reducing unnecessary row rendering and handler re-registration. Existing actions and product defaults remain unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…test Co-Authored-By: Claude Opus 5.5 <[email protected]>
EvidenceMeasured in the real Windows Server 2025 Electron app (Electron 44.10.1), on the same 4-vCPU/16-GB machine, light theme, 1440 × 1000 viewport at DPR 1, with GPU disabled. Each commit was built in its own worktree and used a fresh database and separate Chromium profile. The scenario runner explicitly excludes performance regressions, so this used the manual desktop path. Steps: seed the same synthetic project and 200 threads through each commit's server/CLI using Replay (dev), model multi-turn; stop the seed server and its children; click between the same two existing rows, click New Thread, and return to the clicked thread, waiting 1.5 seconds after each action. Run three warm-up cycles, then 12 measured cycles per session, alternating base/head for three sessions each (36 samples per action per commit). Record the same flow separately, followed by Control-click, Shift-click, and plain-click selection checks. Values below are pooled medians; parentheses show the range of the three session medians. All individual samples and their min–max ranges are in the linked output/report.
Switch input-to-paint improves by 40 ms, exceeding the 28 ms largest session-median spread; New Thread improves by 96 ms, exceeding 36 ms. Script improvements are 108.7 ms and 89.5 ms, exceeding spreads of 28.1 ms and 28.7 ms. For both timing metrics and actions, every head session median is lower than every base session median. Each measured switch reached its clicked row, and each New Thread action reached a draft. Both commits also passed Control-click selection, Shift-click range selection without navigation, and plain-click selection clearing/navigation. Full measurement report, including sample min–max ranges. The app retains one empty draft after New Thread, so the DOM total becomes 201 rows; both sides have the same 200 existing server-thread rows. Counts cover SidebarThreadRow and exclude sortable wrappers. Timing uses Event Timing input-to-paint and CDP ScriptDuration, not input-to-first-rAF. Recording overhead is excluded from timing runs. Scripts: seed, measurement driver, alternating-run driver, analysis, recording encoder, chart. Measured by Codex (gpt-6.1-sol). Raw console output for all six timing runs and both recordings. Not shown:
|
Sync 1201d: 87 upstream commits to 5709d8c. Seven additive hunks in Sidebar.tsx, SettingsPanels.tsx and SidebarThreadRow.tsx, from upstream pingdotgg#46460 (General Translation v12) and pingdotgg#47105 (stable sidebar row callbacks). Fork strings with options move to the v12 template form, including fork files that did not conflict. Fork strings without a catalog entry still render in English. No fork feature dropped. Lockfile changed; upstream migration 125. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…roups off Four tests upstream added in this range (pingdotgg#45651, pingdotgg#47105, pingdotgg#46745, pingdotgg#45886) assume the flat inbox. The fork's project groups are on by default and start folded, so a folded group shows only the open thread as a compact row without the project name. These tests now turn groups off, as the fork's earlier adaptations do; their assertions are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Surgically ports 62 upstream Web UI fixes from pingdotgg/t3code (772e3d4..1e6e7d7) into apps/web and scripts/scenarios while preserving all 31 locked T4 customizations, T4 branding, and t4-overrides.css. Also restores React Compiler compilation for Sidebar by moving the default new Set(...) parameter inside settleLaunchGroup into the function body so switching threads produces 0 unaffected row re-renders. Ported (62 commits): - 1a08049 (pingdotgg#46481): right-panel launcher keys blocked while context menu open - 6bdd718 (pingdotgg#46489): Enter restores highlighted stashed prompt (scenario e2e; web code already absorbed) - 347f551 (pingdotgg#46490): Escape closes open context menu before layer beneath it - afa3003 (pingdotgg#46487): workflows page uses width of wide window - a2ba869 (pingdotgg#46485): keep joined emoji whole in screen-reader announcements - a8ee725 (pingdotgg#46493): holding stash shortcut keeps prompt saved (scenario e2e; web code already absorbed) - 5048c80 (pingdotgg#46499): Mod+S moves edited queued reply to prompt stash - 179e6c3 (pingdotgg#46506): holding stash delete shortcut removes one prompt (scenario e2e; web code already absorbed) - c101437 (pingdotgg#44079): fold PR diff whose header was clicked - 9b27e5a (pingdotgg#46562): second Mod+T keeps right-panel Add menu shortcuts working - 62cf1fe (pingdotgg#46592): wait for dialog focus before opening context menu over it - fda1c30 (pingdotgg#46579): resting on issue row prefetches detail - 28f0c93 (pingdotgg#46593): slash-command description tooltip closes when modal opens - 789784b (pingdotgg#46603): keep selected tab in Workflows links - 2bc37d9 (pingdotgg#46597): / and Mod+F in Settings ignore open context menu - b21923b (pingdotgg#46640): effort shortcut closes nested Permissions menu in model picker - a5a39fa (pingdotgg#46641): inline thread details card grows with interface font size - 36983d6 (pingdotgg#46644): workflow runs open in resizable right panel - 2ad902f (pingdotgg#46691): Mod+F on PRs page ignores open menu - 97d727c (pingdotgg#46699): Link pull request dialog closes when leaving thread - 7a9d213 (pingdotgg#46729): refuse saving edit to deleted project script action - bdda9ce (pingdotgg#46745): settling open delegated task opens next thread - 3763606 (pingdotgg#46760): command menu description tooltip closes on composer focus loss - 00eae4b (pingdotgg#46764): reopen workflow run on first click - 19094fd (pingdotgg#46765): boring sidebar folder rows offer snooze again - dec756c (pingdotgg#46766): reopen last workflow run after hiding panel - 33ce571 (pingdotgg#46777): keep workflow runs open behind tab menus - a989ee8 (pingdotgg#46779): restore focus after closing workflow run - 5c42b2e (pingdotgg#46786): reopen closed workflow run tabs - caec30f (pingdotgg#46792): cancel tab drags when switching threads - 27cf2cf (pingdotgg#46794): disable empty panel shortcuts as it closes - d65936e (pingdotgg#46791): reveal all side panel tabs when they fit - a9daa0b (pingdotgg#46781): right-panel shortcuts ignore presses while menu/dialog open - 35b6c5f (pingdotgg#46801): dismissing PR checkout toast cancels handoff - e9da1b0 (pingdotgg#46818): boring sidebar folder row actions keep height and clicks - 9feac49 (pingdotgg#46855): long PR search preserves grapheme clusters - acef160 (pingdotgg#46849): find shared voice dictionary by Japanese label - 19da14d (pingdotgg#46796): scrolled right panel tabs no longer block chat titlebar drag - 506bc36 (pingdotgg#46853): close guest share and handoff dialogs when leaving thread - b4fd7ba (pingdotgg#46879): let Escape and app shortcuts pass through terminal font preview - f5689ae (pingdotgg#46835): long history load errors wrap without timeline horizontal overflow - 6b64b0c (pingdotgg#46890): focus command dialog popup when search input disabled - 70c9da7 (pingdotgg#46900): focus PR Author/Labels filter search inputs on keyboard open - 891bf1a (pingdotgg#46924): late slash results no longer open tooltip after focus leaves - 80f0f8a (pingdotgg#46930): copying failed message keeps its images - e9ca942 (pingdotgg#46659): show workflow question kinds only in filter - aa8c7c7 (pingdotgg#46941): queued message moves to stash only once removed - 3ea13b6 (pingdotgg#46940): editing answer while image prepares cancels held submit - a143526 (pingdotgg#46970): pasting copied file over reattach marker no longer reports failure - b33c330 (pingdotgg#47011): stub addComposerFilesToDraft with new return shape in test - a0fb9d1 (pingdotgg#46974): Issues Labels/Assignee filters focus search on keyboard open - cb525f4 (pingdotgg#47029): clicking anywhere on terminal or panel tab activates it - 498a3b6 (pingdotgg#47022): syncing messages line no longer shifts whole chat - e903c85 (pingdotgg#47046): pasted messages with thread link keep picture - 6a13142 (pingdotgg#47013): limit style invalidation during right-panel resize - cd8961e (pingdotgg#47078): pasting copied file no longer takes preparing screenshot slot - 8d0fb4b (pingdotgg#47100): stop showing previous Usage period as loading after failure - 515b8c9 (pingdotgg#47114): Tab from Permissions menu keeps focus inside model picker - a681dd5 (pingdotgg#47125): middle-clicking file link no longer opens broken tab - bbde8dc (pingdotgg#44842): use plus icon for project new-thread buttons - 59af88f (pingdotgg#47105): switching threads no longer re-renders unaffected sidebar rows - 1e6e7d7 (pingdotgg#47080): Reopen Closed Tab skips workflow runs removed from history Already absorbed in HEAD (3 commits): - 20a0e5f (pingdotgg#46927), a684090 (pingdotgg#47026), c557dab (pingdotgg#47076) Skipped cleanly (3 commits): - 70224ca (pingdotgg#46712): depends on unported ui/open-popups.tsx (pingdotgg#45341) - cf475c4 (pingdotgg#47034): depends on unported ui/open-popups.tsx (pingdotgg#45341) - be3cc6c (pingdotgg#47145): depends on unported fitsWithAllowance/workGroupOverflowAllowance in TimelineWorkGroupRows.tsx



Problem
Creating a new thread or switching between threads re-renders every rendered thread row in the left sidebar (
Sidebar), even rows whose selection, route, and badge state did not change.SidebarpasseshandleThreadClick(onThreadClick) andattemptSettle(onSettle) down to every memoizedSidebarThreadRow. Both closures capture route-dependent state (routeThreadKey,activeThreadKey, and navigation/selection state), so their function identity changes on every route transition and defeatsSidebarThreadRowmemoization across the entire thread list (plus triggersregisterSettleAndAdvancere-registration on every route change). On a workspace with ~200 rendered sidebar rows, this adds ~60–76 ms of avoidable JS work to every thread switch and New Thread click.Change
handleThreadClickandattemptSettleinapps/web/src/components/Sidebar.tsxwith the existinguseStableCallbackhook (handleThreadClickStable,attemptSettleStable), which keeps a stable function reference per mount while invoking the latest committed closure viauseInsertionEffect.handleThreadClickStableasonThreadClick, passattemptSettleStableasonSettle, and registerattemptSettleStableinregisterSettleAndAdvance.apps/web/src/components/Sidebar.browser.test.tsx(sidebar render isolation) with a regression test verifying that switching threads triggers zero re-renders on unaffected rows while preserving Ctrl/Cmd multi-select, Shift range-select against the updated route anchor, and settle-and-advance behavior.Scope
Small, focused performance bug fix (2 files:
Sidebar.tsx+ existingSidebar.browser.test.tsx) with no visual or behavior changes.Verification
Sidebar.browser.test.tsxfailed onmain(7e2b0947) with 2 unaffected row renders on thread switch and passed with 0 unaffected row renders after this change.vp fmt --check,vp lint(0 warnings, 0 errors across 206 rules), and@t3tools/webtypecheck passed.SidebarThreadRowduring both thread switching and New Thread creation. Onmain,onThreadClickandonSettlechanged identity; with this fix, 0/16 changed.main)draft)draft)draft)Built with Gemini 4 Neon in Antigravity (T3 Code).