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

Something similar to cache-first for Apollo and Urql? #38

Open
frederikhors opened this issue Apr 14, 2021 · 1 comment
Open

Something similar to cache-first for Apollo and Urql? #38

frederikhors opened this issue Apr 14, 2021 · 1 comment

Comments

@frederikhors
Copy link
Collaborator

frederikhors commented Apr 14, 2021

Coming from Apollo or Urql I would like to know if there is a way to mimic (or improve) the behavior of policies like "cache-first":

(the default) prefers cached results and falls back to sending an API request when no prior result is cached: https://formidable.com/open-source/urql/docs/basics/document-caching/#request-policies.

An example: I already have user data queried in Home page then I navigate to User page and I wanna say to svelte-query to NOT query again my user data because I already have them in cache (with Infinite stale).

Am I wrong to want this?

I tried with the enabled option but obviously if navigate on the user's page before the Home page the query does not start at all.

How to do?

@xstevenyung
Copy link

I think you can use Initial Query Data in this case: https://sveltequery.vercel.app/guides/initial-query-data

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