@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.
- package/CHANGELOG.md +18 -0
- package/__cjs/core/ApolloClient.cjs +7 -9
- package/__cjs/core/ApolloClient.cjs.map +1 -1
- package/__cjs/core/ApolloClient.d.cts +7 -9
- package/__cjs/core/ObservableQuery.cjs +5 -3
- package/__cjs/core/ObservableQuery.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.cjs +6 -4
- package/__cjs/react/ssr/useSSRQuery.cjs.map +1 -1
- package/__cjs/react/ssr/useSSRQuery.d.cts +2 -1
- package/__cjs/utilities/subscriptions/relay/index.cjs +8 -2
- package/__cjs/utilities/subscriptions/relay/index.cjs.map +1 -1
- package/__cjs/version.cjs +1 -1
- package/core/ApolloClient.d.ts +7 -9
- package/core/ApolloClient.js +7 -9
- package/core/ApolloClient.js.map +1 -1
- package/core/ObservableQuery.js +5 -3
- package/core/ObservableQuery.js.map +1 -1
- package/package.json +1 -1
- package/react/ssr/useSSRQuery.d.ts +2 -1
- package/react/ssr/useSSRQuery.js +7 -5
- package/react/ssr/useSSRQuery.js.map +1 -1
- package/utilities/subscriptions/relay/index.js +8 -2
- package/utilities/subscriptions/relay/index.js.map +1 -1
- package/version.js +1 -1
|
@@ -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
|
-
*
|
|
749
|
+
* link: link,
|
|
749
750
|
*
|
|
750
751
|
* // Provide some optional constructor fields
|
|
751
|
-
*
|
|
752
|
-
*
|
|
753
|
-
*
|
|
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
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|