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

Suggestion: Stale While Revalidate cache management #35

Open
arnaudbzn opened this issue Dec 27, 2020 · 1 comment
Open

Suggestion: Stale While Revalidate cache management #35

arnaudbzn opened this issue Dec 27, 2020 · 1 comment

Comments

@arnaudbzn
Copy link

The demo is great and the performances are impressive.

More and more, Web apps use State While Revalidate for remote data fetching thanks to excellent libraries as SWR, react-query and Apollo Client.

It makes sense for React Server Components to support this pattern too.

In the demo, the data stored in the Postgres database could be changed by another user.
In the current implementation, only mutations done by the current app user refresh the cache.
With State While Revalidate remote data fetching, the changes done by other users will be reflected.

It would be great to see this feature demonstrated with React Server Components even in a minimal version.

@arnaudbzn arnaudbzn changed the title Suggestion: Stale While Revalide cache management Suggestion: Stale While Revalidate cache management Dec 27, 2020
@gaearon
Copy link
Member

gaearon commented Jan 2, 2021

In this demo you could do this by invalidating the cache more often (see useRefresh). We’ll offer more granular refetching and cache invalidation APIs in the future versions.

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

No branches or pull requests

2 participants