react-infinite-scroller icon indicating copy to clipboard operation
react-infinite-scroller copied to clipboard

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

Open Develob opened this issue 4 years ago • 2 comments

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.

Develob avatar Nov 26 '21 11:11 Develob

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.

wsajjadh avatar Dec 27 '21 03:12 wsajjadh

const isRef = useRef(null);

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

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

sanonz avatar Sep 26 '22 14:09 sanonz