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

Unified cache key for all resource states #1723

Closed
shuding opened this issue Dec 23, 2021 · 0 comments
Closed

Unified cache key for all resource states #1723

shuding opened this issue Dec 23, 2021 · 0 comments

Comments

@shuding
Copy link
Member

shuding commented Dec 23, 2021

In SWR, each resource has its own states such as data, error, and isValidating. And that list is expected to grow with more meta information in the future. updatedAt (#1703) is a good example, as well as createdAt, status (#1215), isMutated (#1316).

Currently we are storing each state separately with a specific key (derived from the original key) in the cache, which is poorly designed and not very extendable. Instead, we can hold all states in one object in the cache, keyed by the original resource key.

This will be a breaking change for those who directly reads from the cache.

@shuding shuding added this to the 2.0 milestone Dec 23, 2021
@shuding shuding added feature request New feature or request improvement and removed feature request New feature or request labels Dec 24, 2021
@shuding shuding removed this from the 2.0 milestone Feb 18, 2022
@shuding shuding closed this as completed Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant