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

Is it possible to reset the start page when requesting new data or switching the filter? #287

Open
Develob opened this issue Nov 26, 2021 · 2 comments

Comments

@Develob
Copy link

Develob commented Nov 26, 2021

Is your feature request related to a problem? Please describe.
Hi, I ran into such a problem that when requesting new data, the home page counter remains from the previous request.

That is: I scrolled, got page number 4, then I switch the filter, start scrolling the page and my request starts from page 5, and I would like to start from 1.

@wsajjadh
Copy link

I had similar requirement. I set separate state for page counting, request end points so whenever user change the filter It will change the state so the request is starting from page one. This is how I solved the requirement.

@sanonz
Copy link

sanonz commented Sep 26, 2022

const isRef = useRef(null);

<InfiniteScroll
    ref={isRef}
    ....
/>

// Reset the start page
isRef.current.pageLoaded = 0;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants