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

additional caching strategies for data fetching composables #14699

Open
danielroe opened this issue Aug 24, 2022 · 1 comment
Open

additional caching strategies for data fetching composables #14699

danielroe opened this issue Aug 24, 2022 · 1 comment

Comments

@danielroe
Copy link
Member

danielroe commented Aug 24, 2022

For data fetching composables, we offer initialCache which can either be switched on or off. But in some cases, users may have more advanced strategies, such as refetching after a certain time period or when the tab is reactivated.

Some use cases:

@pi0
Copy link
Member

pi0 commented Aug 24, 2022

Related PR and description: nuxt/framework#3985

initialCache flag was introduced in nuxt/framework#3985 as a way to revert the effect of the change we have. It is not a caching strategy.

We could have another issue for force-fetch or track via (#2973). It is not a caching strategy exactly either and removed in same nuxt/framework#3985 PR to be supported back via a better API and also cancel support.

More I think higher-order composables or asyncData handlers with a cache wrapper can provide caching strategies for fetcher. The handler can return the cached value. And such wrapper could be more veastile than having a built-in fixed implementation of cached functions i was initially proposing in nuxt/framework#3985.

@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
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

2 participants