onderonur / react-infinite-scroll-hook

React hook for creating infinite scroll components.
https://onderonur.github.io/react-infinite-scroll-hook/
MIT License
447 stars 36 forks source link

How to force a reload of the already rendered list ? #28

Closed jacargentina closed 2 years ago

jacargentina commented 2 years ago

I have a search term Input, so the infinite scroll is affected by that: when I change the criteria for that Input, I need all items to be cleared and re-fetch with the new criteria. How can I achieve that?

onderonur commented 2 years ago

This issue depends on which state/cache management method you are using actually. Built-in react state, redux, react-query, swr, apollo etc. has their own methods to handle this kind of situations and this is not so dependant on this package I think. So, you can check useInfiniteQuery hook if you use react-query from infinite queries section for example.

I also have a similar search page here created by using swr (I will probably migrate it to react-query soon btw) and this hook.

khaledosama999 commented 2 years ago

@onderonur The link that leads to the page is broken, can you please update it