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
We need to make sure that mutate() invalidates concurrent requests and deduplicates them. It’ll be similar to this test case, but without a target value (only revalidates):
It turns to be introduced in #1498 which I think should be the correct behavior, that mutate() will not be deduplicated by default because it was triggered explicitly by the user. So if calling two mutate()s in a row:
mutate()mutate()
It's expected to have 2 revalidation requests started.
However requests fired with useSWR(key, fetcher) should be deduplicated, if we do mutate(). This is working as expected.
I think the solution here is to have a way to manually revalidate with deduplication enabled. We'll have to come up with a new option for that...
@shuding But what if you have 2 components that run on a timer and use mutate to trigger a revalidate? Then we will have more than one request running, which does not make much sense. Even when the revalidate is user triggered, it should deduplicate. Otherwise this is highly confusing and not (!) documented.
Uh oh!
There was an error while loading. Please reload this page.
X-ref: nandorojo/swr-react-native#18
We need to make sure that
mutate()
invalidates concurrent requests and deduplicates them. It’ll be similar to this test case, but without a target value (only revalidates):swr/test/use-swr-local-mutation.test.tsx
Lines 361 to 384 in d45b05d
The text was updated successfully, but these errors were encountered: