Open talkl opened 3 years ago
Same issue. Have to use this trick:
React.useEffect(() => {
const scrollable = document.getElementById("scrollableDiv");
scrollable.scrollTop = 0
},[searchString])
react-infinite-scroll-component latest with apollo graphql
@4ndv
can you help?
Same issue. Have to use this trick:
React.useEffect(() => { const scrollable = document.getElementById("scrollableDiv"); scrollable.scrollTop = 0 },[searchString])
react-infinite-scroll-component latest with apollo graphql
doesn't work for me.
@popsa85 how can i reach you privately?
Made it work!
this is the solution:
https://github.com/vercel/swr/issues/1168#issuecomment-864490525
Bug report
userSwrInfinite + react-infinite-scroll-component bug
Description / Observed Behavior
I have react-infinite-scroll-component with useSwrInfinite integration. I also have an input to search by name the api. if i'm beyond page 1 and do a search (thus changing the useSwrInfinite key), useSwrInifinite will start searching serially all pages until the current page i am 1...N. It's interesting to observe that if my scroll position is viewing only the first page, then only the first page will be fetched not 1...N
Expected Behavior
I expect that on change of key in useSwrInfinite get key function will reset the scroll position to the first page.
Repro Steps / Code Example
https://codesandbox.io/s/react-infiinite-scroll-component-with-userswrinfinite-bug-reproduce-ch7hi
Reproduce steps:
Expected Behaviour steps:
another way to see expected behaviour:
Thank you guys I
https://user-images.githubusercontent.com/9368630/118966849-b04a4600-b972-11eb-8871-7cf439284d34.mov
appreciate it :)