Repository navigation
perf(scene-bar): memoize tabItems compilation to prevent redundant tab allocations - #3799
Open
Raing5Days wants to merge 1 commit into
Open
Raing5Days wants to merge 1 commit into
Raing5Days wants to merge 1 commit into
Conversation
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
Optimize
SceneBartab list compilation by wrappingtabItemscreation inuseMemo, eliminating unconditional re-allocation of 20+TabGroupItemobjects, JSX button end-actions, and badge nodes on unrelated re-renders.shownTabs.reduceinto a dedicateduseMemoanchored onshownTabs,sessionLabels,resources,tabDefs, and i18n translators.@openbitfun/ui'sTabGroup, allowing downstream tab items to skip virtual DOM re-diffing and keep focused hit targets intact.Type and Areas
Performance / refactoring. Web UI layout and scene tabs (
src/web-ui/src/app/components/SceneBar/SceneBar.tsx). No wire protocol, persisted schema, or styling regressions.Motivation / Impact
Previously,
SceneBarexecutedshownTabs.reduceunconditionally at the component root level. In sessions with many tabs (e.g. 15–25 tabs, opening overflow strips):TabGroupItemobjects, button JSX nodes, and close handlers.TabGroupreceived a completely new items array reference on every frame, forcing redundant reconciliations across all tab DOM elements.With
useMemo:TabGroupItemarrays and child button structures remain referentially identical across active scene switches and scrolling unless tab definitions or titles actually change.OpCase-Tab-Dehydration-01, 24 tabs, 20 switches) demonstrates:Verification
node scripts/run-vitest.mjs run --maxWorkers=50% "src/app/components/SceneBar/SceneBar.test.tsx"— 24 passed (100%).node scripts/check-repo-hygiene.mjs— passed.node --test scripts/check-repo-hygiene.test.mjs— 3 passed (100%).node scripts/verify-release-version-sync.mjs— passed.node scripts/format-changed-rust.mjs— passed.git diff --check— clean.Checklist