@apollo/client 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -738,24 +738,22 @@ export declare class ApolloClient {
738
738
  * @example
739
739
  *
740
740
  * ```js
741
- * import { ApolloClient, InMemoryCache } from "@apollo/client";
741
+ * import { ApolloClient, InMemoryCache, HttpLink } from "@apollo/client";
742
742
  *
743
743
  * const cache = new InMemoryCache();
744
+ * const link = new HttpLink({ uri: "http://localhost:4000/" });
744
745
  *
745
746
  * const client = new ApolloClient({
746
747
  * // Provide required constructor fields
747
748
  * cache: cache,
748
- * uri: "http://localhost:4000/",
749
+ * link: link,
749
750
  *
750
751
  * // Provide some optional constructor fields
751
- * name: "react-web-client",
752
- * version: "1.3",
753
- * queryDeduplication: false,
754
- * defaultOptions: {
755
- * watchQuery: {
756
- * fetchPolicy: "cache-and-network",
757
- * },
752
+ * clientAwareness: {
753
+ * name: "react-web-client",
754
+ * version: "1.3",
758
755
  * },
756
+ * queryDeduplication: false,
759
757
  * });
760
758
  * ```
761
759
  */
@@ -221,9 +221,11 @@ class ObservableQuery {
221
221
  });
222
222
  }
223
223
  getInitialResult(initialFetchPolicy) {
224
- const fetchPolicy = this.queryManager.prioritizeCacheValues ?
225
- "cache-first"
226
- : initialFetchPolicy || this.options.fetchPolicy;
224
+ let fetchPolicy = initialFetchPolicy || this.options.fetchPolicy;
225
+ if (this.queryManager.prioritizeCacheValues &&
226
+ (fetchPolicy === "network-only" || fetchPolicy === "cache-and-network")) {
227
+ fetchPolicy = "cache-first";
228
+ }
227
229
  const cacheResult = () => {
228
230
  const diff = this.getCacheDiff();
229
231
  // TODO: queryInfo.getDiff should handle this since cache.diff returns a