@apollo/client 3.9.10 → 3.10.0-rc.0
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/.changeset/chatty-llamas-switch.md +5 -0
- package/.changeset/pre.json +14 -0
- package/.changeset/stupid-bears-cheat.md +5 -0
- package/.changeset/tasty-pillows-ring.md +5 -0
- package/.changeset/tiny-bugs-tap.md +5 -0
- package/.changeset/twelve-apples-vanish.md +5 -0
- package/CHANGELOG.md +18 -0
- package/apollo-client.cjs +43 -10
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +27 -0
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +27 -0
- package/cache/core/cache.d.ts +83 -1
- package/cache/core/cache.js +30 -1
- package/cache/core/cache.js.map +1 -1
- package/core/ApolloClient.d.ts +19 -1
- package/core/ApolloClient.js +20 -1
- package/core/ApolloClient.js.map +1 -1
- package/core/core.cjs +4 -1
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +4 -1
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/package.json +2 -1
- package/react/hooks/hooks.cjs +23 -17
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +23 -17
- package/react/hooks/useFragment.js +17 -14
- package/react/hooks/useFragment.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +1 -1
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +0 -1
- package/react/query-preloader/createQueryPreloader.js +0 -1
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/react.cjs.map +1 -1
- package/testing/core/core.cjs +103 -0
- package/testing/core/core.cjs.map +1 -1
- package/testing/core/core.cjs.native.js +103 -0
- package/testing/core/createMockFetch.d.ts +38 -0
- package/testing/core/createMockFetch.js +79 -0
- package/testing/core/createMockFetch.js.map +1 -0
- package/testing/core/createProxiedSchema.d.ts +47 -0
- package/testing/core/createProxiedSchema.js +99 -0
- package/testing/core/createProxiedSchema.js.map +1 -0
- package/testing/core/index.d.ts +2 -0
- package/testing/core/index.js +2 -0
- package/testing/core/index.js.map +1 -1
- package/testing/graphql-tools/utils.d.ts +26 -0
- package/testing/graphql-tools/utils.js +172 -0
- package/testing/graphql-tools/utils.js.map +1 -0
- package/testing/graphql-tools/utils.test.d.ts +2 -0
- package/testing/graphql-tools/utils.test.js +139 -0
- package/testing/graphql-tools/utils.test.js.map +1 -0
- package/testing/index.d.ts +1 -0
- package/testing/index.js +1 -0
- package/testing/index.js.map +1 -1
- package/testing/testing.cjs +134 -0
- package/testing/testing.cjs.map +1 -1
- package/testing/testing.cjs.native.js +134 -0
- package/utilities/globals/globals.cjs +1 -1
- package/utilities/globals/globals.cjs.map +1 -1
- package/utilities/globals/globals.cjs.native.js +1 -1
- package/version.js +1 -1
package/cache/cache.cjs
CHANGED
|
@@ -96,6 +96,33 @@ var ApolloCache = (function () {
|
|
|
96
96
|
if (optimistic === void 0) { optimistic = !!options.optimistic; }
|
|
97
97
|
return this.read(tslib.__assign(tslib.__assign({}, options), { rootId: options.id || "ROOT_QUERY", optimistic: optimistic }));
|
|
98
98
|
};
|
|
99
|
+
ApolloCache.prototype.watchFragment = function (options) {
|
|
100
|
+
var _this = this;
|
|
101
|
+
var fragment = options.fragment, fragmentName = options.fragmentName, from = options.from, _a = options.optimistic, optimistic = _a === void 0 ? true : _a;
|
|
102
|
+
var diffOptions = {
|
|
103
|
+
returnPartialData: true,
|
|
104
|
+
id: typeof from === "string" ? from : this.identify(from),
|
|
105
|
+
query: this.getFragmentDoc(fragment, fragmentName),
|
|
106
|
+
optimistic: optimistic,
|
|
107
|
+
};
|
|
108
|
+
var latestDiff;
|
|
109
|
+
return new utilities.Observable(function (observer) {
|
|
110
|
+
return _this.watch(tslib.__assign(tslib.__assign({}, diffOptions), { immediate: true, query: _this.getFragmentDoc(fragment, fragmentName), callback: function (diff) {
|
|
111
|
+
if (equality.equal(diff, latestDiff)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
var result = {
|
|
115
|
+
data: diff.result,
|
|
116
|
+
complete: !!diff.complete,
|
|
117
|
+
};
|
|
118
|
+
if (diff.missing) {
|
|
119
|
+
result.missing = utilities.mergeDeepArray(diff.missing.map(function (error) { return error.missing; }));
|
|
120
|
+
}
|
|
121
|
+
latestDiff = diff;
|
|
122
|
+
observer.next(result);
|
|
123
|
+
} }));
|
|
124
|
+
});
|
|
125
|
+
};
|
|
99
126
|
ApolloCache.prototype.readFragment = function (options, optimistic) {
|
|
100
127
|
if (optimistic === void 0) { optimistic = !!options.optimistic; }
|
|
101
128
|
return this.read(tslib.__assign(tslib.__assign({}, options), { query: this.getFragmentDoc(options.fragment, options.fragmentName), rootId: options.id, optimistic: optimistic }));
|