@apollo/client 3.7.0-alpha.5 → 3.7.0-alpha.6
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/apollo-client.cjs +26 -25
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/cache/cache.cjs +9 -10
- package/cache/cache.cjs.map +1 -1
- package/cache/cache.cjs.native.js +9 -10
- package/cache/inmemory/readFromStore.d.ts.map +1 -1
- package/cache/inmemory/readFromStore.js +10 -11
- package/cache/inmemory/readFromStore.js.map +1 -1
- package/core/ObservableQuery.d.ts.map +1 -1
- package/core/ObservableQuery.js +2 -2
- package/core/ObservableQuery.js.map +1 -1
- package/core/core.cjs +2 -2
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +2 -2
- package/invariantErrorCodes.js +1 -1
- package/package.json +1 -1
- package/react/hooks/hooks.cjs +7 -2
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +7 -2
- package/react/hooks/useQuery.d.ts +1 -1
- package/react/hooks/useQuery.d.ts.map +1 -1
- package/react/hooks/useQuery.js +7 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/utilities/common/mergeDeep.d.ts.map +1 -1
- package/utilities/common/mergeDeep.js +8 -11
- package/utilities/common/mergeDeep.js.map +1 -1
- package/utilities/utilities.cjs +8 -11
- package/utilities/utilities.cjs.map +1 -1
- package/utilities/utilities.cjs.native.js +8 -11
- package/version.js +1 -1
package/apollo-client.cjs
CHANGED
|
@@ -761,18 +761,15 @@ var DeepMerger = (function () {
|
|
|
761
761
|
};
|
|
762
762
|
DeepMerger.prototype.shallowCopyForMerge = function (value) {
|
|
763
763
|
if (isNonNullObject(value)) {
|
|
764
|
-
if (this.pastCopies.has(value)) {
|
|
765
|
-
if (
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
else {
|
|
773
|
-
value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
764
|
+
if (!this.pastCopies.has(value)) {
|
|
765
|
+
if (Array.isArray(value)) {
|
|
766
|
+
value = value.slice(0);
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
value = tslib.__assign({ __proto__: Object.getPrototypeOf(value) }, value);
|
|
770
|
+
}
|
|
771
|
+
this.pastCopies.add(value);
|
|
774
772
|
}
|
|
775
|
-
this.pastCopies.add(value);
|
|
776
773
|
}
|
|
777
774
|
return value;
|
|
778
775
|
};
|
|
@@ -1301,7 +1298,7 @@ var concat = ApolloLink.concat;
|
|
|
1301
1298
|
|
|
1302
1299
|
var execute = ApolloLink.execute;
|
|
1303
1300
|
|
|
1304
|
-
var version = '3.7.0-alpha.
|
|
1301
|
+
var version = '3.7.0-alpha.6';
|
|
1305
1302
|
|
|
1306
1303
|
var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
1307
1304
|
function parseAndCheckHttpResponse(operations) {
|
|
@@ -2394,7 +2391,6 @@ var StoreReader = (function () {
|
|
|
2394
2391
|
var policies = this.config.cache.policies;
|
|
2395
2392
|
variables = tslib.__assign(tslib.__assign({}, getDefaultValues(getQueryDefinition(query))), variables);
|
|
2396
2393
|
var rootRef = makeReference(rootId);
|
|
2397
|
-
var merger = new DeepMerger;
|
|
2398
2394
|
var execResult = this.executeSelectionSet({
|
|
2399
2395
|
selectionSet: getMainDefinition(query).selectionSet,
|
|
2400
2396
|
objectOrReference: rootRef,
|
|
@@ -2407,9 +2403,6 @@ var StoreReader = (function () {
|
|
|
2407
2403
|
varString: canonicalStringify(variables),
|
|
2408
2404
|
canonizeResults: canonizeResults,
|
|
2409
2405
|
fragmentMap: createFragmentMap(getFragmentDefinitions(query)),
|
|
2410
|
-
merge: function (a, b) {
|
|
2411
|
-
return merger.merge(a, b);
|
|
2412
|
-
},
|
|
2413
2406
|
},
|
|
2414
2407
|
});
|
|
2415
2408
|
var missing;
|
|
@@ -2448,17 +2441,18 @@ var StoreReader = (function () {
|
|
|
2448
2441
|
}
|
|
2449
2442
|
var variables = context.variables, policies = context.policies, store = context.store;
|
|
2450
2443
|
var typename = store.getFieldValue(objectOrReference, "__typename");
|
|
2451
|
-
var
|
|
2444
|
+
var objectsToMerge = [];
|
|
2452
2445
|
var missing;
|
|
2446
|
+
var missingMerger = new DeepMerger();
|
|
2453
2447
|
if (this.config.addTypename &&
|
|
2454
2448
|
typeof typename === "string" &&
|
|
2455
2449
|
!policies.rootIdsByTypename[typename]) {
|
|
2456
|
-
|
|
2450
|
+
objectsToMerge.push({ __typename: typename });
|
|
2457
2451
|
}
|
|
2458
2452
|
function handleMissing(result, resultName) {
|
|
2459
2453
|
var _a;
|
|
2460
2454
|
if (result.missing) {
|
|
2461
|
-
missing =
|
|
2455
|
+
missing = missingMerger.merge(missing, (_a = {}, _a[resultName] = result.missing, _a));
|
|
2462
2456
|
}
|
|
2463
2457
|
return result.result;
|
|
2464
2458
|
}
|
|
@@ -2477,7 +2471,7 @@ var StoreReader = (function () {
|
|
|
2477
2471
|
var resultName = resultKeyNameFromField(selection);
|
|
2478
2472
|
if (fieldValue === void 0) {
|
|
2479
2473
|
if (!addTypenameToDocument.added(selection)) {
|
|
2480
|
-
missing =
|
|
2474
|
+
missing = missingMerger.merge(missing, (_a = {},
|
|
2481
2475
|
_a[resultName] = "Can't find field '".concat(selection.name.value, "' on ").concat(isReference(objectOrReference)
|
|
2482
2476
|
? objectOrReference.__ref + " object"
|
|
2483
2477
|
: "object " + JSON.stringify(objectOrReference, null, 2)),
|
|
@@ -2506,7 +2500,7 @@ var StoreReader = (function () {
|
|
|
2506
2500
|
}), resultName);
|
|
2507
2501
|
}
|
|
2508
2502
|
if (fieldValue !== void 0) {
|
|
2509
|
-
|
|
2503
|
+
objectsToMerge.push((_b = {}, _b[resultName] = fieldValue, _b));
|
|
2510
2504
|
}
|
|
2511
2505
|
}
|
|
2512
2506
|
else {
|
|
@@ -2516,6 +2510,7 @@ var StoreReader = (function () {
|
|
|
2516
2510
|
}
|
|
2517
2511
|
}
|
|
2518
2512
|
});
|
|
2513
|
+
var result = mergeDeepArray(objectsToMerge);
|
|
2519
2514
|
var finalResult = { result: result, missing: missing };
|
|
2520
2515
|
var frozen = context.canonizeResults
|
|
2521
2516
|
? this.canon.admit(finalResult)
|
|
@@ -2529,10 +2524,11 @@ var StoreReader = (function () {
|
|
|
2529
2524
|
var _this = this;
|
|
2530
2525
|
var field = _a.field, array = _a.array, enclosingRef = _a.enclosingRef, context = _a.context;
|
|
2531
2526
|
var missing;
|
|
2527
|
+
var missingMerger = new DeepMerger();
|
|
2532
2528
|
function handleMissing(childResult, i) {
|
|
2533
2529
|
var _a;
|
|
2534
2530
|
if (childResult.missing) {
|
|
2535
|
-
missing =
|
|
2531
|
+
missing = missingMerger.merge(missing, (_a = {}, _a[i] = childResult.missing, _a));
|
|
2536
2532
|
}
|
|
2537
2533
|
return childResult.result;
|
|
2538
2534
|
}
|
|
@@ -4305,7 +4301,7 @@ var ObservableQuery = (function (_super) {
|
|
|
4305
4301
|
newNetworkStatus === exports.NetworkStatus.poll;
|
|
4306
4302
|
var oldVariables = this.options.variables;
|
|
4307
4303
|
var oldFetchPolicy = this.options.fetchPolicy;
|
|
4308
|
-
var mergedOptions =
|
|
4304
|
+
var mergedOptions = compact(this.options, newOptions || {});
|
|
4309
4305
|
var options = useDisposableConcast
|
|
4310
4306
|
? mergedOptions
|
|
4311
4307
|
: assign(this.options, mergedOptions);
|
|
@@ -6188,7 +6184,7 @@ function useInternalState(client, query) {
|
|
|
6188
6184
|
if (!stateRef.current ||
|
|
6189
6185
|
client !== stateRef.current.client ||
|
|
6190
6186
|
query !== stateRef.current.query) {
|
|
6191
|
-
stateRef.current = new InternalState(client, query);
|
|
6187
|
+
stateRef.current = new InternalState(client, query, stateRef.current);
|
|
6192
6188
|
}
|
|
6193
6189
|
var state = stateRef.current;
|
|
6194
6190
|
var _a = React.useState(0); _a[0]; var setTick = _a[1];
|
|
@@ -6198,7 +6194,7 @@ function useInternalState(client, query) {
|
|
|
6198
6194
|
return state;
|
|
6199
6195
|
}
|
|
6200
6196
|
var InternalState = (function () {
|
|
6201
|
-
function InternalState(client, query) {
|
|
6197
|
+
function InternalState(client, query, previous) {
|
|
6202
6198
|
this.client = client;
|
|
6203
6199
|
this.query = query;
|
|
6204
6200
|
this.asyncResolveFns = new Set();
|
|
@@ -6217,6 +6213,11 @@ var InternalState = (function () {
|
|
|
6217
6213
|
});
|
|
6218
6214
|
this.toQueryResultCache = new (canUseWeakMap ? WeakMap : Map)();
|
|
6219
6215
|
verifyDocumentType(query, exports.DocumentType.Query);
|
|
6216
|
+
var previousResult = previous && previous.result;
|
|
6217
|
+
var previousData = previousResult && previousResult.data;
|
|
6218
|
+
if (previousData) {
|
|
6219
|
+
this.previousData = previousData;
|
|
6220
|
+
}
|
|
6220
6221
|
}
|
|
6221
6222
|
InternalState.prototype.forceUpdate = function () {
|
|
6222
6223
|
__DEV__ && tsInvariant.invariant.warn("Calling default no-op implementation of InternalState#forceUpdate");
|