Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Table useInfiniteScroll hook fetches twice #3251

Open
ynchen2829 opened this issue Jun 14, 2024 · 2 comments · May be fixed by #3332
Open

[BUG] - Table useInfiniteScroll hook fetches twice #3251

ynchen2829 opened this issue Jun 14, 2024 · 2 comments · May be fixed by #3332
Assignees
Labels
📦 Scope : Components Related to the components ✨ Type: Enhancement New enhancement on existing codebase

Comments

@ynchen2829
Copy link

ynchen2829 commented Jun 14, 2024

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 from useAsyncList 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 the cursor.next, causing my Table to load the wrong page of data.

Your Example Website or App

codeSandboxLink

Steps to Reproduce the Bug or Issue

  1. Go to sandbox
  2. Run dev server
  3. Inspect to see console.log statements, and two consecutive pages are fetched without being scrolled to the bottom.

Alternative:

  1. Go to nextUI Table Infinite Scroll
  2. Click preview
  3. Notice that the initial load has 20 items instead of 10 (expected behavior), where each loadMore loads 10 more items

Expected behavior

Expected: Initial load calling load once
Seeing: Initial load triggers load once and triggers loadMore without scrolling to bottom.

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

Copy link

linear bot commented Jun 14, 2024

@wingkwong wingkwong added ✨ Type: Enhancement New enhancement on existing codebase 📦 Scope : Components Related to the components labels Jun 15, 2024
@abhisektomar1
Copy link

I am Working on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components ✨ Type: Enhancement New enhancement on existing codebase
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants