fix scroll update problem

This commit is contained in:
nicwands 2026-06-25 13:02:03 -04:00
parent d36c0de7dc
commit 2464e7661c

View file

@ -179,19 +179,18 @@ export const useInfiniteScroll = (options = {}) => {
scrollY: state.scrollY + deltaY,
duration: 1,
ease: 'expo.out',
})
onUpdate: async () => {
const newViewportIndex = calculateVisibleViewport(state.scrollY)
if (newViewportIndex !== state.currentViewportIndex) {
state.currentViewportIndex = newViewportIndex
const rangeStart = newViewportIndex - bufferSize
const rangeEnd = newViewportIndex + bufferSize
await loadViewportsInRange(rangeStart, rangeEnd)
cleanupViewports()
}
},
})
}
// Attach the virtual-scroll listener once Lenis is ready