Repository navigation
refactor(web): the command palette caches its derived lookups without "use memo" - #21116
Merged
Merged
Conversation
… "use memo" Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused compiler-aware refactor that preserves command-palette behavior while retaining caching for existing derived lookups without lint suppressions. It changes no product defaults, schemas, workflows, or sensitive code, and the documentation update is non-runtime. You can add or adjust custom eligibility rules. Learn more. |
Contributor
Thread transfer impact
This comment will update automatically after the next completed run. |
github-actions Bot
added a commit
to omarcresp/t3code-flake
that referenced
this pull request
Oct 18, 2026
## What's Changed * perf(mobile): Metro runs the React Compiler, with a coverage ratchet by @juliusmarminge in pingdotgg/t3code#20967 * perf(mobile): usage screens compile with the React Compiler by @juliusmarminge in pingdotgg/t3code#20969 * perf(mobile): Connect onboarding compiles with the React Compiler by @juliusmarminge in pingdotgg/t3code#20970 * perf(mobile): device preview compiles with the React Compiler by @juliusmarminge in pingdotgg/t3code#20971 * fix(android): foldable sidebar and layout fixes by @t3dotgg in pingdotgg/t3code#21071 * test(mobile): measure renders on a device by @juliusmarminge in pingdotgg/t3code#21001 * fix(web): Working threads can be dragged into chat as references again by @t3dotgg in pingdotgg/t3code#19697 * refactor(web): the command palette caches its derived lookups without "use memo" by @juliusmarminge in pingdotgg/t3code#21116 * feat(mobile): link, unlink and watch a thread's pull requests from its sheet by @flamboh in pingdotgg/t3code#20394 * test(web): the right panel Escape test advances fake frames until focus returns by @juliusmarminge in pingdotgg/t3code#21118 * test(web): ChatMarkdown thread find waits for highlights to settle by @juliusmarminge in pingdotgg/t3code#21121 **Full Changelog**: pingdotgg/t3code@v0.1.1-nightly.20261018.3285...v0.1.1-nightly.20261018.3302 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.1-nightly.20261018.3302
github-actions Bot
added a commit
to davidvanderklay/t3code-flake
that referenced
this pull request
Oct 18, 2026
## What's Changed * perf(mobile): Metro runs the React Compiler, with a coverage ratchet by @juliusmarminge in pingdotgg/t3code#20967 * perf(mobile): usage screens compile with the React Compiler by @juliusmarminge in pingdotgg/t3code#20969 * perf(mobile): Connect onboarding compiles with the React Compiler by @juliusmarminge in pingdotgg/t3code#20970 * perf(mobile): device preview compiles with the React Compiler by @juliusmarminge in pingdotgg/t3code#20971 * fix(android): foldable sidebar and layout fixes by @t3dotgg in pingdotgg/t3code#21071 * test(mobile): measure renders on a device by @juliusmarminge in pingdotgg/t3code#21001 * fix(web): Working threads can be dragged into chat as references again by @t3dotgg in pingdotgg/t3code#19697 * refactor(web): the command palette caches its derived lookups without "use memo" by @juliusmarminge in pingdotgg/t3code#21116 * feat(mobile): link, unlink and watch a thread's pull requests from its sheet by @flamboh in pingdotgg/t3code#20394 * test(web): the right panel Escape test advances fake frames until focus returns by @juliusmarminge in pingdotgg/t3code#21118 * test(web): ChatMarkdown thread find waits for highlights to settle by @juliusmarminge in pingdotgg/t3code#21121 **Full Changelog**: pingdotgg/t3code@v0.1.1-nightly.20261018.3285...v0.1.1-nightly.20261018.3302 Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.1.1-nightly.20261018.3302
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The command palette's five derived-value helpers (theme cards, the thread-search content-match map, environment lookups, project lookups, sorted project groups) kept
"use memo"behindoxlint-disablefort3code/no-manual-memo. They were the last such suppressions inapps/web.Why they needed it
Each helper took its source value as an argument and called no hook. In
infermode the React Compiler only compiles ause*function that actually calls a hook, so without the directive these were treated as plain functions and cached nothing, with no diagnostic. Their call sites in the 2,500-line dialog weren't cached either, because the results flow into item arrays that are built across many interleaved hooks.The change
Each helper now reads its own source hook and derives from it:
useThemeCards()readsuseCustomThemesanduseEnvironmentThemeDefinitions.useThreadSearchWithContentMatches(ids, query)wrapsuseThreadSearchand returns the search together with its content-match map.useEnvironmentLookups()readsuseEnvironments.useProjectLookups()readsuseProjects.useSortedProjectGroups(environmentLabelById)reads projects, threads, project order, client settings and the primary environment id itself.The compiler then gives each derived value a cache scope keyed on its store snapshot. The directives, the suppressions and the comment block are gone.
docs/internals/web-ui.mdgains one sentence about this trap: a hook-freeuse*helper silently gets no cache.I didn't move all item building into a pure module. That would have relocated about 2,000 lines of render code to buy back caching for five values, and this change gets the same caching without it.
Compile proof
Compiled with
oxc-transform-reactusing the options fromreactCompilerCoverage.test.ts(0 diagnostics):Renders
Flow: open the palette (Ctrl+K), type 10 characters, clear them, open Change theme, close. The counter is
rc-init.js(counts only fibers rendered in each commit) on a dev server without--watch, with the samemigrate-dev-dbsnapshot for both. Before is8f026485df(origin/main), after is this branch.OpenCommandPaletteDialogThe modal run is identical on both sides (165 commits, 4850 renders, 61 dialog renders, with the same per-component breakdown). The spread comes from keystroke timing in the driver:
useDeferredValuebatches differently depending on how keystrokes land. I ran two extra "after" runs to rule out a regression. Render counts don't change, because render counts are not where this pays off: the change keeps the lookup Maps, theme cards and sorted groups from being rebuilt on each of the dialog's ~61 renders.Checks
grep '"use memo"\|no-manual-memo'finds nothing inCommandPalette.tsx, and there's nooxlint-disable … no-manual-memoanywhere inapps/web/src.vp lint src/components/CommandPalette.tsxis clean.vp test run src/reactCompilerCoverage.test.ts -t CommandPalettepasses.CommandPalette.logic.test.tspasses (33 tests).tsc-rs --noEmitpasses for apps/web.Claude Opus 5.5 via Claude Code.
🤖 Generated with Claude Code