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] - Pagination controlled page number does not update when setting total after delay #4522

Open
jprosevear opened this issue Jan 8, 2025 · 1 comment · May be fixed by #4536
Open

[BUG] - Pagination controlled page number does not update when setting total after delay #4522

jprosevear opened this issue Jan 8, 2025 · 1 comment · May be fixed by #4536
Assignees
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working

Comments

@jprosevear
Copy link

NextUI Version

2.6.11

Describe the bug

When waiting for API response, with page=0 and total =0, when updating page and total, page is not selected (awaiting API response for initial totals).

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Code is roughly:

const App = () => {  
  const [page, setPage] = useState(0);
  const [total, setTotal] = useState(0);

  useEffect(() => {
    setTimeout(() => {
      console.log('set total');
      setPage(1);
      setTotal(4);
    }, 3000);
  }, []);

 
  return (
      <Pagination page={page} total={total} onChange={setPage} showControls />
      Page: {page}
      {''}Total: {total}
  );
};

Expected behavior

Page 1 should be selected

Screenshots or Videos

Screen.Recording.2025-01-08.at.11.25.56.AM.mov

Operating System Version

macOS

Browser

Chrome

Copy link

linear bot commented Jan 8, 2025

@jprosevear jprosevear changed the title [BUG] - Pagination controlled page number does not update when [BUG] - Pagination controlled page number does not update when setting total after delay Jan 9, 2025
@wingkwong wingkwong self-assigned this Jan 11, 2025
@wingkwong wingkwong added 🐛 Type: Bug Something isn't working 📦 Scope : Components Related to the components labels Jan 11, 2025
@wingkwong wingkwong linked a pull request Jan 11, 2025 that will close this issue
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: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants