From a1bd3d20c473a944a91b1263dbad66d71dddc9bd Mon Sep 17 00:00:00 2001 From: Mathew Piccinato Date: Mon, 29 Dec 2025 13:38:52 -0500 Subject: [PATCH] Don't return early if sticky index changed --- src/core/calculateItemsInView.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/calculateItemsInView.ts b/src/core/calculateItemsInView.ts index 61e711fe..ccb9f138 100644 --- a/src/core/calculateItemsInView.ts +++ b/src/core/calculateItemsInView.ts @@ -194,8 +194,9 @@ export function calculateItemsInView( const currentStickyIdx = stickyIndicesArr.length > 0 ? findCurrentStickyIndex(stickyIndicesArr, scroll, state) : -1; const nextActiveStickyIndex = currentStickyIdx >= 0 ? stickyIndicesArr[currentStickyIdx] : undefined; + const stickyIndexDidChange = previousStickyIndex !== nextActiveStickyIndex; state.activeStickyIndex = nextActiveStickyIndex; - + let scrollBufferTop = scrollBuffer; let scrollBufferBottom = scrollBuffer; @@ -213,7 +214,7 @@ export function calculateItemsInView( const scrollBottomBuffered = scrollBottom + scrollBufferBottom; // Check precomputed scroll range to see if we can skip this check - if (!dataChanged && scrollForNextCalculateItemsInView) { + if (!dataChanged && !stickyIndexDidChange && scrollForNextCalculateItemsInView) { const { top, bottom } = scrollForNextCalculateItemsInView; if (scrollTopBuffered > top && scrollBottomBuffered < bottom) { return;