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

fetchPolicy no-cache for subscriptions #3532

Closed
oudmane opened this issue May 31, 2018 · 1 comment
Closed

fetchPolicy no-cache for subscriptions #3532

oudmane opened this issue May 31, 2018 · 1 comment
Assignees

Comments

@oudmane
Copy link

oudmane commented May 31, 2018

I have I case using apollo-client where I don't need caching at all, I set

defaultOptions = {
    query: {
        fetchPolicy: 'no-cache'
    },
        mutate: {
        fetchPolicy: 'no-cache'
    }
} 

I notice .subscribe({query}) doesn't support fetchPolicy option, also tries to cache the result.

I forked and edited apollo-client, I wrapped this

this.dataStore.markSubscriptionResult(
result,
transformedDoc,

inside

if (options.fetchPolicy && options.fetchPolicy !== 'no-cache') {
    ...
}

I don't know why is this.dataStore.markSubscriptionResult() is enforced (I can't think of cases this maybe useful), and why isn't there a fetchPolicy for subscriptions.

I'll work on a PR to add fetchPolicy to subscription, please let me know if this isn't needed

Thanks

@oudmane oudmane changed the title no-cache in .subscribe() fetchPolicy no-cache for subscriptions May 31, 2018
@hwillson hwillson self-assigned this Aug 2, 2018
hwillson added a commit that referenced this issue Aug 2, 2018
Currently `client.subscribe` calls are ignoring `no-cache`
fetch policy settings. These changes make sure `no-cache`
avoids writing subscription results to the cache.

Fixes #3709.
Fixes #3532.
@hwillson
Copy link
Member

hwillson commented Aug 2, 2018

This has been addressed in #3773. Thanks for pointing this out!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants