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, scrollY: state.scrollY + deltaY,
duration: 1, duration: 1,
ease: 'expo.out', ease: 'expo.out',
}) onUpdate: async () => {
const newViewportIndex = calculateVisibleViewport(state.scrollY) const newViewportIndex = calculateVisibleViewport(state.scrollY)
if (newViewportIndex !== state.currentViewportIndex) { if (newViewportIndex !== state.currentViewportIndex) {
state.currentViewportIndex = newViewportIndex state.currentViewportIndex = newViewportIndex
const rangeStart = newViewportIndex - bufferSize const rangeStart = newViewportIndex - bufferSize
const rangeEnd = newViewportIndex + bufferSize const rangeEnd = newViewportIndex + bufferSize
await loadViewportsInRange(rangeStart, rangeEnd) await loadViewportsInRange(rangeStart, rangeEnd)
cleanupViewports() cleanupViewports()
} }
},
})
} }
// Attach the virtual-scroll listener once Lenis is ready // Attach the virtual-scroll listener once Lenis is ready