-
Notifications
You must be signed in to change notification settings - Fork 6
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
Current page is reset to 1 on page load #18
Comments
The Paginator component takes a currentPage prop, so you can write a useEffect or any logic that extracts the page you want to send the user to from your URL or anywhere else your app stores that data, and pass it to the currentPage prop. How you implement this is up to you since your app has access to update the currentPage prop. |
I see. The component goes to page one on the initial load. Delay setting
currentPage on your app till after the component has loaded. I will push a
fix for this soon
…On Sat, Feb 13, 2021 at 4:42 PM Muhammet Sait ***@***.***> wrote:
Hi! sorry for the late response.
I'm actually passing the currentPage, but it still goes to the first page
anyway. I think the problem may be related to those lines in paginator.js:
useEffect(() => {
gotoPage(1);
}, [gotoPage]);
it always calls gotoPage(1) first regardless of the value of currentPage
prop.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#18 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AET2SON2FM2VHQGJHUQJP63S62MV7ANCNFSM4XDJYOVA>
.
|
Hey, @codenaz, any update on this issue? |
@codenaz Any update? Please. |
#18 use current page prop before falling back to page 1 when setting initial page
#30 |
Hi! I was using this lib with Nextjs and I noticed that if the user requests a page like this:
localhost:3000/products?page=2
page=2
is loaded and then immediately setCurrentPage(1) callback is called, which causespage=1
to load instead.I think it would be better if the paginator was able to keep the current page without going back to page=1 on first load.
The text was updated successfully, but these errors were encountered: