Optimize settings sidebar nav rerenders#2792
Draft
cursor[bot] wants to merge 5 commits into
Draft
Conversation
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
Co-authored-by: Julius Marminge <juliusmarminge@users.noreply.github.com>
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.
What Changed
SettingsSidebarNavItemcomponent with a stable selection callback.docs/react-scan/settings-sidebar-nav/before.webmdocs/react-scan/settings-sidebar-nav/after.webmdocs/react-scan/settings-sidebar-nav/before-counts.jsondocs/react-scan/settings-sidebar-nav/after-counts.jsonWhy
React Doctor plus a manual React Scan pass showed the Settings navigation rerendering every sidebar menu row during settings route changes. For the same interaction path (
Settings->Keybindings->Providers->Source Control->General), React Scan render logs changed from:SidebarMenuItem: 37 before -> 16 afterSidebarMenuButton: 37 before -> 16 afterUnaffected settings rows now remain memoized while the active row changes.
UI Changes
Interaction recordings with React Scan enabled are committed in:
docs/react-scan/settings-sidebar-nav/before.webmdocs/react-scan/settings-sidebar-nav/after.webmChecklist
Validation:
react-doctorscan after fix: noSettingsSidebarNavdiagnosticsbun fmtbun lintbun typecheckNote
Reduce rerenders in settings sidebar nav by extracting
SettingsSidebarNavItemuseCallbackfor its select handler, preventing unnecessary child rerenders.px-2 py-2top-2, which is visually equivalent but uses a different Tailwind class.Macroscope summarized 654f876.