-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dispose of the
queryRef
when changing to previously used variables …
…to allow the `InMemoryCache` to determine cached behavior (#11045) When changing variables to a previously used set of variables, the fetch policy is now honored. Previously when using a fetch policy of `network-only` or `no-cache`, switching to previously used variables would return a cached result and would require a `refetch` to get data from the network again. Now query refs are disposed of when changing variables so that switching back to previously used variables will either return from the `InMemoryCache` or will execute a network request to load from the server.
- Loading branch information
1 parent
a3ab745
commit 9c1d4a1
Showing
8 changed files
with
389 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@apollo/client': minor | ||
--- | ||
|
||
When changing variables back to a previously used set of variables, do not automatically cache the result as part of the query reference. Instead, dispose of the query reference so that the `InMemoryCache` can determine the cached behavior. This means that fetch policies that would guarantee a network request are now honored when switching back to previously used variables. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.