This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
Use cache-first as fetchPolicy for webhook logs #45537
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #44720
The default policy is 'network-only': https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/client/http-client/src/graphql/apollo/client.ts?L68
This is different from what the Apollo docs will tell you, because this is our own implementation.
This is what's causing the double requests. However, this should not reload the entire page, it simply determines how the final data is fetched. From what I can gather, the reloading (or rather, the replacing of the combined data with the initial data) is a bug in apollo <3.6 when using the
network-only
policy (and we're using apollo version 3.5): apollographql/apollo-client#6916One option is to update the apollo client version, but this feels risky given that we don't know if there could be other regressions that happen because of it. Instead, this PR sets the fetchPolicy to
cache-first
instead (which is recommended in that thread, and also how we handle it in other parts of the code base).Test plan
Confirmed to work manually
App preview:
Check out the client app preview documentation to learn more.