Skip to content

Commit

Permalink
Merge branch 'main' into docs/update-overview
Browse files Browse the repository at this point in the history
  • Loading branch information
Meschreiber authored Apr 22, 2024
2 parents e13cbb8 + 45f7501 commit d089826
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/source/data/queries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,17 @@ new ApolloClient({
options,
// The original value of options.fetchPolicy, before nextFetchPolicy was
// applied for the first time.
initialPolicy,
initialFetchPolicy,
// The ObservableQuery associated with this client.watchQuery call.
observable,
}
) {
// When variables change, the default behavior is to reset
// options.fetchPolicy to context.initialPolicy. If you omit this logic,
// options.fetchPolicy to context.initialFetchPolicy. If you omit this logic,
// your nextFetchPolicy function can override this default behavior to
// prevent options.fetchPolicy from changing in this case.
if (reason === 'variables-changed') {
return initialPolicy;
return initialFetchPolicy;
}

if (
Expand Down
2 changes: 1 addition & 1 deletion src/core/__tests__/fetchPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ describe("nextFetchPolicy", () => {

// The nextFetchPolicy function we provided always returnes cache-first,
// even when context.reason is variables-changed (which by default
// resets the fetchPolicy to context.initialPolicy), so cache-first is
// resets the fetchPolicy to context.initialFetchPolicy), so cache-first is
// still what we see here.
expect(observable.options.fetchPolicy).toBe("cache-first");
} else if (count === 3) {
Expand Down

0 comments on commit d089826

Please sign in to comment.