Skip to content

Unified cache key for all resource states #1723

Closed
@shuding

Description

@shuding

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions