fix scroll update problem
This commit is contained in:
parent
d36c0de7dc
commit
2464e7661c
1 changed files with 11 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue