Repository navigation
perf(api-client): stop sidebar and tab bar re-rendering per keystroke - #417
Merged
Merged
Conversation
The API client root re-renders on every keystroke (it reads the active tab). CollectionsSidebar and TabBar re-rendered with it even though nothing they show had changed. - CollectionsSidebar is React.memo; its only prop is stable while typing. - TabBar is memoized on the chip fields it renders (id/kind/method/name), active tab and handlers. - reorderTabs takes (fromId, toId) and moves within the live state via moveTab, so a memoized TabBar holding a stale tabs array can no longer overwrite edits on drop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
The API client root re-renders on every keystroke because it reads the active tab. The collections sidebar (794 lines) and the tab bar re-rendered with it, even though nothing they show had changed.
CollectionsSidebaris nowReact.memo. Its only prop,onLoadRequest, stays the same while typing.TabBaris memoized with a custom check: it re-renders only when a tab's id, kind, method or name changes, the active tab changes, or one of its handlers changes.reorderTabs(fromId, toId)now moves tabs within the current state via a newmoveTabhelper. Before, a drop replaced the whole list with the tab bar's copy of it. Once the tab bar is memoized, that copy can be out of date, so a drag after an edit would have undone the edit.Request editors, the response panel and dialogs already skip re-renders or load lazily, so they are unchanged.
Test plan
tsc --noEmitpassesmoveTabtests)🤖 Generated with Claude Code