-
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
infinite: do not revalidate every page on mutate(undefined) #1590
Comments
This also happens on automatic revalidation |
Ok, this comes to the fact that Fix is: const refresh = useCallback(() => {
res.mutate(d => d, true)
}, [res.mutate]) |
Still happens on beta 8, all pages are revalidated when doing const refresh = useCallback(() => {
res.mutate(d => d, true)
}, [res.mutate]) |
Very weird, let me try to reproduce this. |
If you call Lines 190 to 191 in e167752
We need to improve the local mutation API for pages a bit. |
Hi! Have there been any updates regarding this issue? I'd like to be able to mutate & revalidate a specified page, and not all the loaded pages when calling |
Hi! |
If you find this annoying, you can use my library https://github.com/hazae41/xswr You can revalidate any single page without revalidating everything |
I have to use SWR only, but I found some work around. Thanks! |
hi @misa-minic could you share your solution? I thought about storing all items into a |
Hi @khanhld1910 If not, take a look at: You should be able with mutate to update only a certain KEY which represents each api call/url for getting a next "page" of items. Let me know if you need some info. |
Bug report
Description / Observed Behavior
When I use .mutate(), all pages are revalidated even tough nothing changed in the first page, and the keys didn't change
This behaviour happens regardless of
revalidateIfStale
, and regardless of the newrevalidateFirstPage
Expected Behavior
Do not revalidate if the first page is the same and keys are the same
Repro Steps / Code Example
Additional Context
happening on both swr@1.0.1 and swr@1.1.0-beta.6
The text was updated successfully, but these errors were encountered: