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

(request-policy) - Fix requestPolicyExchange usage with persisted caching #1742

Merged

Conversation

Mookiies
Copy link
Contributor

@Mookiies Mookiies commented Jun 24, 2021

Resolves #1644

Set of changes

Do not set the TTL unless cache outcome is "miss". If the first result to come through the requestPolicyExchange was a cache-hit then the ttl was set initially based on this cache hit and no network request was made. This happens when using
persisted caching with the graphcache exchange since the very first result could be a cache hit.

Mookiies added 3 commits June 24, 2021 17:05
Do not set the TTL unless cache outcome is "miss". If the first result
to come through the requestPolicyExchange was a cache-hit then the ttl was incorrectly
set initially based on this cache hit and no network request was made. This happens when using
persisted caching with the graphcache exchange since the very first result can be a cache hit.

urql-graphql#1644
@changeset-bot
Copy link

changeset-bot bot commented Jun 24, 2021

🦋 Changeset detected

Latest commit: 3be3427

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@urql/exchange-request-policy Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Mookiies Mookiies changed the title Fix/request policy offline caching (request-policy) - Fix/request policy offline caching Jun 24, 2021
@Mookiies Mookiies changed the title (request-policy) - Fix/request policy offline caching (request-policy) - Fix/Request policy with persisted caching Jun 24, 2021
@kitten kitten requested a review from JoviDeCroock June 30, 2021 23:12
@kitten kitten changed the title (request-policy) - Fix/Request policy with persisted caching (request-policy) - Fix requestPolicyExchange usage with persisted caching Jun 30, 2021
@JoviDeCroock JoviDeCroock merged commit 616ac76 into urql-graphql:main Jul 1, 2021
@JoviDeCroock
Copy link
Collaborator

JoviDeCroock commented Jul 1, 2021

Awesome, thank you for the contribution! 🎉 this will now go into a version packages PR and when it's merged the publish will happen

@urql-ci urql-ci mentioned this pull request Jul 1, 2021
@Mookiies Mookiies deleted the fix/request-policy-offline-caching branch September 8, 2021 00:41
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

Successfully merging this pull request may close these issues.

requestPolicyExchange in combination with offlineExchange does not send network request for first query
3 participants