@apollo/client 3.9.7 → 3.10.0-alpha.1
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/flat-singers-kiss.md +5 -0
- package/.changeset/pre.json +11 -0
- package/.changeset/tasty-pillows-ring.md +5 -0
- package/CHANGELOG.md +12 -0
- package/apollo-client.cjs +46 -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 +26 -8
- package/core/ApolloClient.js +26 -7
- 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/core/watchQueryOptions.d.ts +3 -3
- package/dev/dev.cjs +1 -1
- package/dev/dev.cjs.map +1 -1
- package/dev/dev.cjs.native.js +1 -1
- package/package.json +17 -17
- package/react/hooks/hooks.cjs +26 -17
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +26 -17
- package/react/hooks/useFragment.d.ts +1 -1
- package/react/hooks/useFragment.js +22 -14
- package/react/hooks/useFragment.js.map +1 -1
- package/react/internal/cache/QueryReference.d.ts +2 -2
- package/react/internal/cache/QueryReference.js.map +1 -1
- package/react/query-preloader/createQueryPreloader.d.ts +6 -6
- package/react/query-preloader/createQueryPreloader.js.map +1 -1
- package/react/types/types.d.ts +3 -3
- package/react/types/types.documentation.d.ts +4 -4
- package/react/types/types.documentation.js.map +1 -1
- 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 }));
|