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 the new cacheProvider in swr@beta, the documentation says "createCache should not be called inside render, it should be a global singleton.", so my question is if I'm using the <SWRConfig> approach, how do I clear the cache between tests? The documented approach requires that I call useSwr directly in the test or pass cache down to it, however, that's not feasible in practice.
With [email protected] I'm currently using a wrapper function with testing-library and a custom render function:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
With the new
cacheProvider
in swr@beta, the documentation says "createCache should not be called inside render, it should be a global singleton.", so my question is if I'm using the<SWRConfig>
approach, how do I clear the cache between tests? The documented approach requires that I calluseSwr
directly in the test or pass cache down to it, however, that's not feasible in practice.With [email protected] I'm currently using a wrapper function with testing-library and a custom render function:
Would the best approach be to create the cache in the
customRender
function and pass it into the wrapper, like the following?Beta Was this translation helpful? Give feedback.
All reactions