question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to reset the current page?

See original GitHub issue

Adding this issue because it was asked to me directly.

If you’re filtering items, and the data needs to be completely changed, the page needs to be reset back to pageStart.

One solution is adding a method to the component: https://github.com/guillaumervls/react-infinite-scroll/pull/29

But really, if you need your own pagination methods, you should handle it in the state of your own component and ignore the pageToLoad parameter that you’re given.

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:5
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

25reactions
rmariuzzocommented, Oct 25, 2017

@LorisTujiba found a work around that worked for me. Basically, add key property to any element that wrap the react-infinite-scroller and update that key to a different value, and this will cause the whole element to be recreated.

More details: https://stackoverflow.com/a/21750576/439427

25reactions
kalomboscommented, May 19, 2017

I’ve just added the ref to the InfiniteScroll: <InfiniteScroll ref={(scroll) => { this.scroll = scroll; }} />

And reset the current page when i needed it: this.scroll.pageLoaded = 0 Working for me. I am not sure but maybe all is needed just to add reset function to component from the PR above https://github.com/guillaumervls/react-infinite-scroll/pull/29/files#diff-daf041c271b89525b1dde05048d6383dR44

I can create PR but i don’t know is it the best solution or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to reset the Pagination's current page when pageSize ...
The logic here is, since onShowSizeChange triggers first, will set the locla variable setSize to true and set the page num to 1....
Read more >
Make Google your homepage - Google Search Help
Reset your homepage. Choose a browser above, then follow the steps to replace Google with the site you want as your homepage. Check...
Read more >
<input type="reset"> - HTML: HyperText Markup Language
Try entering some text into the text field, and then pressing the reset button. Adding a reset keyboard shortcut. To add a keyboard...
Read more >
JavaScript reset - Javatpoint
In HTML, we can use the reset button to reset the form. In this article, we are discussing how to reset the form...
Read more >
How to completely reset the Google Chrome browser to its ...
Scroll down once more to the bottom of the page. You'll find the “Reset and clean up” section. Click on “Restore settings to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found