Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export the existing cacheClear function (one liner) #272

Closed
wants to merge 2 commits into from

Conversation

JulianG
Copy link

@JulianG JulianG commented Feb 17, 2020

I think this fixes #161 by simply exposing an existing cacheClear function.

I've seen other PRs that address other cache related issues, but I think this is the minimum set of changes (one line) that will enable isolated deterministic tests when manipulating the "key" is not an option.

Fixes vercel#161 by simply exposing an existing function.
I added my tests to the end of the use-swr.test.tsx file because the file wasn't long enough.
@@ -9,3 +9,5 @@ export {
responseInterface
} from './types'
export default useSWR

export { cacheClear } from './config'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally prefer to export this as a function called clearCache. But I'm happy either way.

@shuding
Copy link
Member

shuding commented Feb 24, 2020

Thank you for your contribution @JulianG! However we already have #231 in the works, which will expose more cache APIs including clearing the cache. I'm going to close this PR for now. 🙏

@shuding shuding closed this Feb 24, 2020
@JulianG
Copy link
Author

JulianG commented Feb 24, 2020

Yes. That makes sense. Cheers!

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.

Have a way to clear cache
2 participants