Shu Ding
Shu Ding
@nandorojo the beta version doesn't have this requirement, you can still use `useSWR([userId, 'user'], getUser)`. Actually we are trying to introduce as fewer breaking changes as possible.
SWR will serialize all the non-string keys internally before passing them to the custom cache provider. We are thinking about exposing that serialization util as APIs as well in #1337,...
We haven't looked into type-safe way of mutating specific cache keys, what's on the docs right now is mostly for showing ideas about how people might want to use the...
> Got it! Is there a way to import the global cache without creating a custom one? Currently the default global cache is not exposed because we are unsure about...
> Plus, if I accidentally auto-import the global mutate from SWR instead of my own custom one, it could be hard to catch. That's a very good point, we definitely...
Thanks @nandorojo! I updated the sandbox a bit to make it work: https://codesandbox.io/s/angry-snowflake-r6pj5?file=/pages/index.js. I think we have to mutate to force trigger revalidating for existing hooks.
> Is there a way to trigger revalidation for all those queries, but not actually refetch the network calls? All I want to do is clear the cache out, and...
I think generally, we need to think again about our error APIs of `mutate()`: should it throw right away or set the error state, or both? I'd like to keep...
Great call! I think compare should only be called for individual pages, instead of the pages array.
Thanks for reporting! That is the expected behavior and let me explain why it happens (and only happens for the first page). First all SWR hooks will refetch when you...