-
-
Notifications
You must be signed in to change notification settings - Fork 630
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
Disable cache #692
Comments
Because of how integral the cache is, a final policies = Policies(
fetch: FetchPolicy.networkOnly,
);
return ValueNotifier<GraphQLClient>(
GraphQLClient(
cache: cache,
link: link,
defaultPolicies: DefaultPolicies(
watchQuery: policies,
query: policies,
mutate: policies,
),
),
); I seem to remember someone implementing a |
I tried with the above and still had (frustratingly hard to find) issues with the library changing some parts of the server response from under my feet. What I did to completely turn off caching (and messing up with server response altogether) was this instead: final policies = Policies(
fetch: FetchPolicy.noCache,
);
return ValueNotifier<GraphQLClient>(
GraphQLClient(
cache: cache,
link: link,
defaultPolicies: DefaultPolicies(
watchQuery: policies,
query: policies,
mutate: policies,
),
),
); |
@matehat if you could open an issue to document the frustrating response changes, that'd be appreciated. I'm guessing you're referring to the cache round trip we do to integrate in any optimistic changes? |
This also just turned out to be the solution to a very annoying bug I was having, steps to repro:
Maybe I am just using it incorrectly, but this seems like strange default behaviour. Adding network-only luckily solved it in my case. Is this in docs anywhere? Maybe under caching the section we could add a "How to disable cache" item. |
Is your feature request related to a problem? Please describe.
Our customer don't want to cache anything on the app. So we tried
Both don't work:
'package:graphql/src/core/query_options.dart': Failed assertion: line 174 pos 16: 'cache != null': is not true.
Describe the solution you'd like
Remove @required for cache
The text was updated successfully, but these errors were encountered: