-
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
Stale data with fallbackData, keepPreviousData and disabled revalidation #2128
Comments
koba04
added a commit
to koba04/swr
that referenced
this issue
Sep 22, 2022
koba04
added a commit
to koba04/swr
that referenced
this issue
Sep 23, 2022
koba04
added a commit
to koba04/swr
that referenced
this issue
Sep 23, 2022
…epPreviousData is enabled test: add a failed test for vercel#2128
koba04
added a commit
to koba04/swr
that referenced
this issue
Sep 23, 2022
…epPreviousData is enabled test: add a failed test for vercel#2128
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Description / Observed Behavior
This bug occurs when using the new
keepPreviousData
option (in v2 beta) together withfallbackData
and disabling the automatic revalidation features. The first time you switch back to the "initial key" the returned data doesn't update. It belongs to the previous key.Subsequent key changes back to the initial key works fine. Note that this only happens when disabling revalidation When using the default revalidation settings this doesn't occur at all.
Expected Behavior
See reproduction.
My use case here is that I don't want to refetch the data on the client when mounting. The fallbackData is fresh/retrieved during SSR.
Repro Steps / Code Example
Check the checkbox and the data filters, uncheck the checkbox and the data is stale. Further toggling/key changes works as expected.
https://codesandbox.io/s/exciting-agnesi-e704i2?file=/src/App.js
Additional Context
SWR version: 2.0.0-beta.6
The text was updated successfully, but these errors were encountered: