The native React Compiler skipped Sidebar.tsx with 15 bailouts, so none of the sidebar was compiled. This PR does more than get it compiling: Sidebar joins the strict REACT_COMPILED_FILES list with no manual memoization (103 useMemo/useCallback removed) and none of the compiler's effect rules broken. There are no disable comments.
Why removing memos had to change structure. A plain removal still compiled, but 33 values lost their caching, including the dnd-kit sorting strategy, the drag handlers and the thread partition. Inside the 2,800-line component the compiler couldn't prove that the local maps and arrays stayed unchanged. Hook return values reach the caller frozen, so the derivations moved into hooks:
useSidebarThreads reads its own inputs (thread shells, the working-shelf setting, the minute clock, the snooze-wake timer, the shelf state). It returns the partition, the shelves, ordered keys, threadByKey, sectionByThreadKey and the pinned/active key maps.
partitionSidebarThreads is a pure module function. It takes clockKey (nowMinute plus the snooze wake tick) as an explicit input. Before, the minute tick only ran because nowMinute happened to be listed in a memo's deps.
useSidebarLookups builds the project and environment maps.
resolveDraggedOrders computes drag previews, with a NO_DRAGGED_ORDERS constant for when nothing is dragging.
I checked the compiled output for each value dnd-kit and the rows depend on:
dndModifiers, the sensor options and the rename/drag-cancel handlers are computed once.
sortableIds is cached on the list items.
sidebarSortingStrategy and dndCollisionDetection are cached on the drag state and the thread maps.
- The drag start and end handlers are cached on the section and thread maps.
- Each settle, snooze and pin handler is cached on its own command.
Effects that copied state became render-time logic:
- The search highlight resets when the result list changes.
- The snooze menu closes when its button goes away.
- The optimistic drop hold releases in the same frame as the drop.
- The settled-tail reset lives in the threads hook.
- Clearing the selection happens where the scope changes, including the auto-correct when a scoped project disappears.
WorkingDuration keeps its clock in state, ticked by its interval, instead of calling Date.now() during render.
Removed: the change-request snapshot props and subscription that rows never read, plus isInFlight, showHoverActions and other unused locals.
Also from the compile pass:
SidebarDraftBlock reads the route-draft row from the draft maps it subscribes to.
- Settle and snooze release their in-flight guard right after the await, since those commands settle into results and never throw.
Tests: reactCompiledFiles, the Sidebar.* logic, drag, motion, pointer and snooze tests, and ThreadStatusIndicators (327 pass).
Stack progress#
| Layer | ChatView lines | ChatView component body | Compiler on ChatView | Files held to strict compiler lint |
|---|
| main | 11,660 | 10,007 | crashes (internal error) | 0 |
| #20161 pending approvals and questions hook | 11,222 | 9,624 | crashes (internal error) | 0 |
| #20164 terminal drawer and panel file | 10,614 | 9,624 | crashes (internal error) | 0 |
| #20289 one terminal open/close hook | 10,466 | 9,481 | crashes (internal error) | 0 |
| #20292 compile-required lint list | 10,466 | 9,481 | crashes (internal error) | 2 |
| #20294 pending hook compiles | 10,466 | 9,481 | crashes (internal error) | 3 |
| #20296 /usage-limits panel hook | 10,397 | 9,416 | crashes (internal error) | 4 |
| #20304 queued-message editing hook | 10,172 | 9,200 | crashes (internal error) | 5 |
| #20308 linked pull request hook | 10,078 | 9,106 | crashes (internal error) | 6 |
| #20309 proactive panel hook | 9,950 | 8,984 | crashes (internal error) | 7 |
| #20312 agent-opened previews hook | 9,855 | 8,890 | crashes (internal error) | 8 |
| #20315 right panel close hook | 9,743 | 8,779 | crashes (internal error) | 9 |
| #20316 worktree setup hook | 9,660 | 8,695 | crashes (internal error) | 10 |
| #20321 two onSend phases split out | 9,660 | 8,613 | crashes (internal error) | 10 |
| #20340 compiler no longer crashes on ChatView | 9,647 | 8,599 | skips (32 reasons) | 10 |
| #20379 ChatView compiles | 9,616 | 8,469 | compiles | 11 |
| #20380 re-render fixes from profiling | 9,661 | 8,514 | compiles | 11 |
| #20392 provider pushes keep identity | 9,628 | 8,481 | compiles | 11 |
| #20393 keyboard shortcuts command map | 9,340 | 8,265 | compiles | 13 |
| → #20396 Sidebar compiles, no manual memos | 9,340 | 8,265 | compiles | 14 |
| #20397 ChatComposer compiles | 9,340 | 8,265 | compiles | 14 |
| #20401 project script editing hook | 9,110 | 8,049 | compiles | 15 |
| #20402 MessagesTimeline compiles | 9,110 | 8,049 | compiles | 16 |
| #20418 ChatView strict: no memos, no sync effects | 8,901 | 7,855 | compiles | 17 |
Measured with the native React Compiler (oxc-transform-react) on each layer's ChatView.tsx. "Crashes" means it hit an internal codegen error and left ChatView uncompiled; "skips" means it reported reasons it could not compile it. Strict files must compile with no bailouts, no manual memoization and no effect-rule violations; lint and reactCompiledFiles.test.ts enforce it.
🤖 Generated with Claude Code (Claude Opus 5.5)
Thread transfer impact#
⚠️ The latest CI run did not produce a thread transfer result for
c58c9ea.This comment will update automatically after the next completed run.