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
Supports "no-cache" fetchPolicy with pollInterval #10020
Supports "no-cache" fetchPolicy with pollInterval #10020
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, with some non-blocking suggestions for possible simplifications. Thanks @MrDoomBringer!
Co-authored-by: Ben Newman <ben@benjamn.com>
…ger/apollo-client into pollinterval-no-cache
Co-authored-by: Ben Asher <benasher44@gmail.com>
@MrDoomBringer @hwillson 👋 is there anything preventing us from merging this change in now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great - thanks @MrDoomBringer!
@jpvajda I'm 👍 with merging. Thanks! |
- Update apollo client to latest version to fix bug where "no-cache" does not work when pollInterval is set - see apollographql/apollo-client#10020
Fixes #9691
Fixes #6187
Adds support for the "no-cache" fetchPolicy to pollInterval.
Most fetchPolicies don't make sense to use when polling, as users probably don't want to be polling the cache directly. As such, currently polling will overwrite the fetchPolicy with "network-only".
However, "no-cache" is also useful for when the user wants to control whether or not their results are written to the cache, so this PR goes ahead and adds a check to allow that policy through, and a relevant test.
The check this adds looks similar to a fetchPolicy sieve in
refetch()
, and it might be worth looking into how to make that functionality a bit more generalized/cleaner.I also went ahead and added a
pollFetchPolicy
type as a way to codify and clarify the rationale for this change, please let me know if I should change anything here!Checklist: