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
When using SWRConfig to set the cache provider it is ignored when used in React.StrictMode. I believe this has to do with StrictMode rendering function components twice (docs). When initCache is called the second time around with the same cache it returns undefined and therefore the provider never ends up using the value (here).
Bug report
Description / Observed Behavior
When using
SWRConfig
to set the cache provider it is ignored when used inReact.StrictMode
. I believe this has to do withStrictMode
rendering function components twice (docs). WheninitCache
is called the second time around with the same cache it returnsundefined
and therefore the provider never ends up using the value (here).Expected Behavior
The provided configuration should be respected.
Repro Steps / Code Example
https://codesandbox.io/s/awesome-moon-4d8xb
Toggle
strict
to trigger the issue.Additional Context
The text was updated successfully, but these errors were encountered: