Skip to content

perf(list): stabilize item registry order#515

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-list-registry-stable-order
Closed

perf(list): stabilize item registry order#515
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-list-registry-stable-order

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

What changed

  • Store each List.Item registry order in a ref, matching the existing Grid item pattern, so selection-context renders do not allocate a new order.
  • Add scripts/test-list-registry-stable-order.mjs as both a reportable churn measurement and a regression guard.

Why

  • ListItemComponent consumes SelectedItemActionsContext so selected item changes re-render the hidden List item tree.
  • The previous render-time ++itemOrderCounter participated in the registration layout-effect dependencies, causing every item to unregister/register when selection changed.
  • Keeping order stable removes the registry churn while preserving selected item action rendering inside the item context tree.

Compatibility impact

  • Behavior-preserving for selection, actions, details, empty views, grouping, keyboard controls, and ordering.
  • No new UI strings or i18n changes.
  • Small local type annotation on the accessory mapper only removes an implicit-any diagnostic in the touched file.

How tested

  • Before metric: node scripts/test-list-registry-stable-order.mjs --report on pre-change code with 1,000 items and 25 selection moves reported orderMode=render-counter, layoutEffectRestarts=25000, registryMutationsOnSelection=50000, registryVersionUpdatesOnSelection=25.
  • After metric: the same report now shows orderMode=stable-ref, layoutEffectRestarts=0, registryMutationsOnSelection=0, registryVersionUpdatesOnSelection=0.
  • node --test scripts/test-list-registry-stable-order.mjs
  • pnpm test (passes; live Electron crash recovery test skipped because Electron is not launchable here)
  • pnpm check:i18n (exits 0; reports existing Italian missing keys: settings.ai.whisper.vocabulary, settings.extensions.appSearchScope)
  • pnpm build:main
  • pnpm build:renderer
  • LSP diagnostics for src/renderer/src/raycast-api/list-runtime-renderers.tsx: no errors
  • Optional pnpm exec tsc -p tsconfig.renderer.json --noEmit still fails on existing renderer-wide type debt outside this change.

@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated renderer performance PR #533: #533. Closing this scoped source PR so review stays centralized there.

@JustYannicc JustYannicc closed this Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant