-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
revalidateOnMount is broken on useSWRInfinite #926
Comments
@pedro-pedrosa Could you explain what you expect? |
Sorry I probably should have explained my codesandbox a little bit better. each mount/unmount increments a counter by 1. this counter is passed as prop to a component that gets mounted/unmounted. this component calls however the number never changes on each mount/unmount, it's always 0 as it's the first value returned by the fetcher. when it's mounted, if you click "revalidate", it calls if you enable the |
@pedro-pedrosa |
I thought you return null in your key getter when there are no more pages? so it only revalidates when there are more pages to show? Please note that manual |
Confirmed that this is fixed in the latest version: https://codesandbox.io/s/quizzical-agnesi-fzjkw?file=/src/Component.js. One thing to keep in mind is |
Bug report
Description / Observed Behavior
useSWRInfinite
is not revalidating on mount when prop is set in configExpected Behavior
It should revalidate on mount
Repro Steps / Code Example
CodeSandbox
mounting/unmounting has no effect on the data reendered on the page. note how it works with a
useEffect
call tomutate()
Additional Context
SWR version. 0.4.0
The text was updated successfully, but these errors were encountered: