You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a reopen of #590. I have added a repro in CodeSandbox. cc @shuding
Bug report
Description / Observed Behavior
I'm using useSWRInfinite with revalidateAll: true to revalidate all cached pages when component mounts or on focus. But it causes revalidation of all pages when loading next page.
Clicking "Load more" button two times will cause 5 requests: https://example.com/issues?page=1https://example.com/issues?page=2https://example.com/issues?page=1https://example.com/issues?page=2https://example.com/issues?page=3
So loading N pages will cause N(N + 1)/2 requests.
Expected Behavior
I expect useSWRInfinite with revalidateAll: true not to revalidate all pages when loading next page but to revalidate all pages on focus, reconnect, mount etc (similar to useSWR hook).
Right now I can do something like this to achieve desirable behavior but it feels hacky:
This is a reopen of #590. I have added a repro in CodeSandbox. cc @shuding
Bug report
Description / Observed Behavior
I'm using
useSWRInfinite
withrevalidateAll: true
to revalidate all cached pages when component mounts or on focus. But it causes revalidation of all pages when loading next page.Clicking "Load more" button two times will cause 5 requests:
https://example.com/issues?page=1
https://example.com/issues?page=2
https://example.com/issues?page=1
https://example.com/issues?page=2
https://example.com/issues?page=3
So loading N pages will cause N(N + 1)/2 requests.
Expected Behavior
I expect
useSWRInfinite
withrevalidateAll: true
not to revalidate all pages when loading next page but to revalidate all pages on focus, reconnect, mount etc (similar touseSWR
hook).Right now I can do something like this to achieve desirable behavior but it feels hacky:
Additional Context
SWR v2.1.5
CodeSandbox Repro
Here is a repro of the issue. click load more with the network tab open and you will see N requests on each click
The text was updated successfully, but these errors were encountered: