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
With this code, I expect res.data to be undefined on next render when calling unset()
However, it is still the same value even though the fallback has been set to undefined
Currently in SWR, undefined isn't a valid data type. It's marked as an initial value which stands for "data is missing", but you can't mutate a resource to be undefined. This is something SWR should fix (e.g. mutating a resource as deleted), while I'd suggest using null or an extra layer like { data: undefined } for now.
Note: this is unrelated to fallbackData.
shuding
changed the title
mutate(undefined) doesn't work with state-based fallback
mutate(undefined) doesn't work
Sep 21, 2021
I've noticed that mutate(undefined) works correctly with the latest version — gonna close this issue, but feel free to reopen if you can provide a reproduction!
Bug report
With this code, I expect res.data to be undefined on next render when calling unset()
However, it is still the same value even though the fallback has been set to undefined
before unset:
after unset:
Additional Context
[email protected]
The text was updated successfully, but these errors were encountered: