Open naporin0624 opened 10 months ago
Thank you for developing this wonderful library. I found some changes in the documentation that would make it even better!
swr's defaultCache is created using initCache and swr's global mutate references it. https://github.com/vercel/swr/blob/main/_internal/src/utils/config.ts#L43-L45
There have been a few issues about SWRConfig not working when using global mutate after changing the provider in SWRConfig, and this would solve that problem.
https://github.com/vercel/swr/issues/2799
https://codesandbox.io/s/swr-initcache-ltfwn6?file=/src/App.tsx
@naporin0624 is attempting to deploy a commit to the Vercel Team on Vercel.
A member of the Team first needs to authorize it.
Description
Thank you for developing this wonderful library. I found some changes in the documentation that would make it even better!
swr's defaultCache is created using initCache and swr's global mutate references it. https://github.com/vercel/swr/blob/main/_internal/src/utils/config.ts#L43-L45
There have been a few issues about SWRConfig not working when using global mutate after changing the provider in SWRConfig, and this would solve that problem.
https://github.com/vercel/swr/issues/2799
Example
https://codesandbox.io/s/swr-initcache-ltfwn6?file=/src/App.tsx