themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.84k stars 411 forks source link

fix(pagination): updating lastPage variable correctly for table layout #1151

Closed rajatpandey441 closed 9 months ago

rajatpandey441 commented 9 months ago

The page number was not showing correctly on first few clicks because lastPage variable was not updating on the first few clicks when the layout was table due to incorrect addition. Was working correctly when the layout was pagination.

fix #1150

Summarize the changes made and the motivation behind them. lastPage variable was set to currentPage+2 which is correct for pagination layout but for table layout, it needs to be currentPage+4 so that lastPage can be 5 after first click only. Reference related issues using # followed by the issue number.

1150

If there are breaking API changes - like adding or removing props, or changing the structure of the theme - describe them, and provide steps to update existing code. NA

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
flowbite-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 26, 2023 3:56pm
codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (7461173) 99.54% compared to head (2db498e) 93.60%. Report is 161 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1151 +/- ## ========================================== - Coverage 99.54% 93.60% -5.95% ========================================== Files 163 213 +50 Lines 6621 9049 +2428 Branches 401 484 +83 ========================================== + Hits 6591 8470 +1879 - Misses 30 579 +549 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

rajatpandey441 commented 9 months ago

I see that this PR is approved. How can I merge this PR? This is my first PR in this repository.

SutuSebastian commented 9 months ago

I see that this PR is approved. How can I merge this PR? This is my first PR in this repository.

Usually a maintainer of this repo checks it, approves it and merges it, in this case @rluders and @tulup-conner are able to do that. I do not hold that access yet.

rajatpandey441 commented 9 months ago

@SutuSebastian Thanks for letting me know. Appreciate it.

rajatpandey441 commented 9 months ago

We can also add a attribute "pageSize" rather than defining 5 records per page for better flexibility.