Skip to content

Conversation

@naporin0624
Copy link

@naporin0624 naporin0624 commented Nov 4, 2023

Description

Thank you for developing this wonderful library. I found some changes in the documentation that would make it even better!

  • The provider passed to SWRConfig has been changed to one using initCache.
  • Added to the documentation to use the return value of initCache instead of using global mutate.

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.

vercel/swr#2799

  • Adding new page
  • Updating existing documentation
  • Other updates

Example

https://codesandbox.io/s/swr-initcache-ltfwn6?file=/src/App.tsx

@vercel
Copy link
Contributor

vercel bot commented Nov 4, 2023

@naporin0624 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant