Repository navigation
perf: eliminate composer #/@ mention menu typing lag - #1307
Merged
Merged
Conversation
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Summary
Eliminate severe typing lag when typing
#/@in the Composer to open the delegation/command/skill/thread/file mention menu across both Web UI and Codex Desktop (renderer-extension).Root Causes & Fixes
K × Scandidate refetches (ui-input-trigger/src/client/controller.ts):AbortControllerentries while preserving generation & abort guards so unrelated in-flight sources are never aborted or redundantly re-queried.ui-sidebar-files/src/client/file-mentions.ts):FILE_MENTION_DEBOUNCE_MS) aroundremote.fileReferences.list, immediately cancelling priorAbortSignals during rapid typing, plus in-flight deduplication per(sessionId, query)without slowing down local Agent/command/skill filtering.ui-codexhost/src/client/thread-reference-discovery.ts):O(W + T + M log M)rebuilds.NON_EMPTY_QUERY_THREAD_LIMIT(25) to avoid mounting hundreds of option DOM nodes.MenuViewgeometry & sticky-group observer dependencies (MenuView.tsx,useAnchoredMaxHeight.ts,MenuGroup.tsx):state.open(instead of the entirestateobject) touseAnchoredMaxHeight, observe the composer card/parent viaResizeObserver, ignore scroll events originating inside the menu itself, and keep listeners stable while mounted.useStickyMenuGroupsand track mounted<MenuGroup>key structure soIntersectionObserver/ResizeObserverare rebuilt only when group structure changes.ui-codexhost/src/client/harness-discovery.tsx):harnessAgentIcon(harnessId, hostId)components by icon identity instead of allocating new inline functions on every.map(), preventing per-keystroke SVG /RemotePluginIconremounts.ui-conversation/src/client/input/editor/runtime.ts,facade.ts):inputTriggers.track(...)duringcompositionstart–compositionendand immediately flush oncompositionend.persistDraft(localStorage.setItem+JSON.stringify) writes with a 180ms debounce (DRAFT_PERSIST_DEBOUNCE_MS), flushing immediately on send (submit/commitDraft), session switch (unbind),pagehide/beforeunload,persistCurrentDraft, anddispose.MenuView.module.css,MenuSurface.tsx,MenuSurface.module.css):material="solid"onMenuSurface(skippingbackdrop-filter: blur(40px) saturate(150%)and the macOS.backingportal) and apply crisp opaque light (rgb(248, 249, 250)) and dark (rgb(48, 49, 54)) fills inMenuView.module.css.#menu hot path (packages/renderer-extension/src/renderer-delegation-mention.ts,renderer-binding-probe.ts):input/selectionchangeevents and skiprender()onsameQuerywhen the catalog fingerprint is unchanged.render()and invokescrollIntoViewonly whenactiveIndexactually changes.mutationMayAffectComposerto avoid triggering full-document Composer scans on menu updates.Visual Verification
Captured and inspected rendered Playwright screenshots of the real
MenuView+ theme stylesheets over dense transcript/code content in both light and dark modes (1024×760 @2x):data-menu-material="solid",backdrop-filter: none,background-color: rgb(248, 249, 250), crisp hairline border + prominent elevation shadow, zero bleed-through over code blocks behind the menu, zero clipping (backingCount: 0).data-menu-material="solid",backdrop-filter: none,background-color: rgb(48, 49, 54), clearrgba(255, 255, 255, 0.16)hairline border + shadow separation over dark transcript, clean section headers and highlight contrast, zero bleed-through or clipping (backingCount: 0).Validation
apps/web-ui/packages/client/ui-input-trigger/test/lexicon-notifications.test.tsapps/web-ui/packages/client/ui-sidebar-files/test/file-mentions.test.tsapps/web-ui/packages/client/ui-codexhost/test/thread-reference-discovery.test.tsapps/web-ui/packages/client/ui-codexhost/test/harness-discovery-icons.test.tsapps/web-ui/packages/client/ui-codexhost/test/harness-discovery.test.tsapps/web-ui/packages/client/ui-conversation/test/draft-persistence-and-ime.test.tsapps/web-ui/packages/client/ui-conversation/test/draft-editor-text-ref.test.tsapps/web-ui/packages/client/ui-conversation/test/keymap-enter.test.tspackages/renderer-extension/test/renderer-delegation-mention.test.tspackages/renderer-extension/test/renderer-skill-library.test.tsnpx tsc --noEmit -p apps/web-ui/tsconfig.json— passednpx tsc -b packages/renderer-extension— passednpx prettier --check(all 22 changed files) — passednpm run build:web:ui— passed