Skip to content

Commit 6f48248

Browse files
committed
fix: skip scroll-based fetch effect in virtualized branch list path
When shouldVirtualizeBranchList is true, branchListScrollElementRef stays null because setBranchListRef is only attached to the non-virtualized ComboboxList. The branches.length effect would call maybeFetchNextBranchPage which bails out immediately due to the null scroll element. Guard the effect to skip when virtualized, since the LegendList onEndReached callback already handles infinite loading in that path, and with 40+ items the visible area is always filled.
1 parent 64275d4 commit 6f48248

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

apps/web/src/components/BranchToolbarBranchSelector.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,9 @@ export function BranchToolbarBranchSelector({
460460
}, [isBranchMenuOpen, maybeFetchNextBranchPage]);
461461

462462
useEffect(() => {
463+
if (shouldVirtualizeBranchList) return;
463464
maybeFetchNextBranchPage();
464-
}, [branches.length, maybeFetchNextBranchPage]);
465+
}, [branches.length, maybeFetchNextBranchPage, shouldVirtualizeBranchList]);
465466

466467
const triggerLabel = getBranchTriggerLabel({
467468
activeWorktreePath,

0 commit comments

Comments
 (0)