Commit 59197ad
committed
perf(sidebar): eliminate unnecessary re-renders in workspace switcher for non-search users
- onMouseEnter: only set highlightedIndex when showSearch is true, preventing
a state update + re-render on every workspace row hover for users with ≤ 3
workspaces where the search is never shown
- onOpenChange: only reset workspaceSearch and highlightedIndex when showSearch
is true, since both values are always already at their defaults for non-search
users and setting them triggers a pointless re-render during dropdown close
- data-workspace-row-idx: only set when showSearch is true since the scroll
effect that reads this attribute is already gated on showSearch1 parent 0f9ea0a commit 59197ad
1 file changed
Lines changed: 3 additions & 3 deletions
File tree
- apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | | - | |
| 358 | + | |
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
483 | | - | |
| 482 | + | |
| 483 | + | |
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| |||
0 commit comments