[BUG] - Table useInfiniteScroll hook fetches twice #3251
Labels
📦 Scope : Components
Related to the components
✨ Type: Enhancement
New enhancement on existing codebase
NextUI Version
2.4.1
Describe the bug
Following the example code for Infinite pagination in nextUI Table Infinite Scroll, the expected behavior is that when the page initially loads, fetch is performed once to load the initial page, however,
loadMore
fromuseAsyncList
hook is called immediately after the initial load, causing the app to load not only one, but two pages.This may not seem like a big deal, but in my customized software, when I call
list.reload
, this behavior rises concurrency issue and messes up thecursor.next
, causing my Table to load the wrong page of data.Your Example Website or App
codeSandboxLink
Steps to Reproduce the Bug or Issue
console.log
statements, and two consecutive pages are fetched without being scrolled to the bottom.Alternative:
loadMore
loads 10 more itemsExpected behavior
Expected: Initial load calling
load
onceSeeing: Initial load triggers
load
once and triggersloadMore
without scrolling to bottom.Screenshots or Videos
No response
Operating System Version
macOS
Browser
Chrome
The text was updated successfully, but these errors were encountered: