Skip to content

perf(api-client): stop sidebar and tab bar re-rendering per keystroke - #417

Merged
itsmeakhil merged 1 commit into
mainfrom
perf/api-client-render
Nov 9, 2026
Merged

itsmeakhil merged 1 commit into
mainfrom
perf/api-client-render

Conversation

@itsmeakhil

Copy link
Copy Markdown
Owner

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.

  • CollectionsSidebar is now React.memo. Its only prop, onLoadRequest, stays the same while typing.
  • TabBar is 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 new moveTab helper. 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 --noEmit passes
  • API client jest suites pass (12 suites, plus new moveTab tests)
  • Tauri: type quickly in the URL and body with 10+ tabs open
  • Tauri: edit a tab's body, then drag the tab to reorder it; the edit should be kept
  • Tauri: rename, duplicate and close tabs; the active-tab highlight should follow method and name changes

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
mydevtools-tech Ready Ready Preview Nov 9, 2026 6:43am UTC

@itsmeakhil
itsmeakhil merged commit ede243b into main Nov 9, 2026
2 of 4 checks passed

This branch was successfully deployed

1 active deployment
Preview — bc9bd1fc Deployed Nov 9, 2026 by vercel[bot]
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