@apollo/client 3.13.5 → 3.13.7
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 +14 -0
- package/apollo-client.cjs +94 -100
- package/apollo-client.cjs.map +1 -1
- package/apollo-client.min.cjs +1 -1
- package/core/ObservableQuery.d.ts +18 -1
- package/core/ObservableQuery.js +103 -34
- package/core/ObservableQuery.js.map +1 -1
- package/core/QueryInfo.d.ts +0 -8
- package/core/QueryInfo.js +10 -73
- package/core/QueryInfo.js.map +1 -1
- package/core/QueryManager.d.ts +2 -2
- package/core/QueryManager.js +15 -19
- package/core/QueryManager.js.map +1 -1
- package/core/core.cjs +91 -98
- package/core/core.cjs.map +1 -1
- package/core/core.cjs.native.js +91 -98
- package/core/types.d.ts +0 -2
- package/core/types.js.map +1 -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 +1 -1
- package/react/hooks/hooks.cjs +3 -1
- package/react/hooks/hooks.cjs.map +1 -1
- package/react/hooks/hooks.cjs.native.js +3 -1
- package/react/hooks/useQuery.d.ts +2 -2
- package/react/hooks/useQuery.js +4 -2
- package/react/hooks/useQuery.js.map +1 -1
- package/react/internal/internal.cjs +1 -1
- package/react/internal/internal.cjs.map +1 -1
- package/react/internal/internal.cjs.native.js +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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @apollo/client
|
|
2
2
|
|
|
3
|
+
## 3.13.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#12540](https://github.com/apollographql/apollo-client/pull/12540) [`0098932`](https://github.com/apollographql/apollo-client/commit/009893220934081f6e5733bff5863c768a597117) Thanks [@phryneas](https://github.com/phryneas)! - Refactor: Move notification scheduling logic from `QueryInfo` to `ObservableQuery`
|
|
8
|
+
|
|
9
|
+
- [#12540](https://github.com/apollographql/apollo-client/pull/12540) [`0098932`](https://github.com/apollographql/apollo-client/commit/009893220934081f6e5733bff5863c768a597117) Thanks [@phryneas](https://github.com/phryneas)! - Refactored cache emit logic for ObservableQuery. This should be an invisible change.
|
|
10
|
+
|
|
11
|
+
## 3.13.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#12285](https://github.com/apollographql/apollo-client/pull/12285) [`cdc55ff`](https://github.com/apollographql/apollo-client/commit/cdc55ff54bf4c83ec8571508ec4bf8156af1bc97) Thanks [@phryneas](https://github.com/phryneas)! - keep ObservableQuery created by useQuery non-active before it is first subscribed
|
|
16
|
+
|
|
3
17
|
## 3.13.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/apollo-client.cjs
CHANGED
|
@@ -7,10 +7,10 @@ var tsInvariant = require('ts-invariant');
|
|
|
7
7
|
var equal = require('@wry/equality');
|
|
8
8
|
var graphql = require('graphql');
|
|
9
9
|
var caches = require('@wry/caches');
|
|
10
|
+
var optimism = require('optimism');
|
|
10
11
|
var zenObservableTs = require('zen-observable-ts');
|
|
11
12
|
require('symbol-observable');
|
|
12
13
|
var trie = require('@wry/trie');
|
|
13
|
-
var optimism = require('optimism');
|
|
14
14
|
var graphqlTag = require('graphql-tag');
|
|
15
15
|
var React = require('rehackt');
|
|
16
16
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespace(e) {
|
|
|
31
31
|
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal);
|
|
32
32
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
33
33
|
|
|
34
|
-
var version = "3.13.
|
|
34
|
+
var version = "3.13.7";
|
|
35
35
|
|
|
36
36
|
function maybe(thunk) {
|
|
37
37
|
try {
|
|
@@ -5169,7 +5169,13 @@ var ObservableQuery = (function (_super) {
|
|
|
5169
5169
|
tslib.__extends(ObservableQuery, _super);
|
|
5170
5170
|
function ObservableQuery(_a) {
|
|
5171
5171
|
var queryManager = _a.queryManager, queryInfo = _a.queryInfo, options = _a.options;
|
|
5172
|
-
var _this =
|
|
5172
|
+
var _this = this;
|
|
5173
|
+
var startedInactive = ObservableQuery.inactiveOnCreation.getValue();
|
|
5174
|
+
_this = _super.call(this, function (observer) {
|
|
5175
|
+
if (startedInactive) {
|
|
5176
|
+
queryManager["queries"].set(_this.queryId, queryInfo);
|
|
5177
|
+
startedInactive = false;
|
|
5178
|
+
}
|
|
5173
5179
|
try {
|
|
5174
5180
|
var subObserver = observer._subscription._observer;
|
|
5175
5181
|
if (subObserver && !subObserver.error) {
|
|
@@ -5197,6 +5203,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5197
5203
|
}) || this;
|
|
5198
5204
|
_this.observers = new Set();
|
|
5199
5205
|
_this.subscriptions = new Set();
|
|
5206
|
+
_this.dirty = false;
|
|
5200
5207
|
_this.queryInfo = queryInfo;
|
|
5201
5208
|
_this.queryManager = queryManager;
|
|
5202
5209
|
_this.waitForOwnResult = skipCacheDataFor(options.fetchPolicy);
|
|
@@ -5440,7 +5447,7 @@ var ObservableQuery = (function (_super) {
|
|
|
5440
5447
|
})
|
|
5441
5448
|
.finally(function () {
|
|
5442
5449
|
if (isCached && !updatedQuerySet.has(_this.query)) {
|
|
5443
|
-
reobserveCacheFirst(
|
|
5450
|
+
_this.reobserveCacheFirst();
|
|
5444
5451
|
}
|
|
5445
5452
|
});
|
|
5446
5453
|
};
|
|
@@ -5549,8 +5556,9 @@ var ObservableQuery = (function (_super) {
|
|
|
5549
5556
|
return options.fetchPolicy;
|
|
5550
5557
|
};
|
|
5551
5558
|
ObservableQuery.prototype.fetch = function (options, newNetworkStatus, query) {
|
|
5552
|
-
this.queryManager.
|
|
5553
|
-
|
|
5559
|
+
var queryInfo = this.queryManager.getOrCreateQuery(this.queryId);
|
|
5560
|
+
queryInfo.setObservableQuery(this);
|
|
5561
|
+
return this.queryManager["fetchConcastWithInfo"](queryInfo, options, newNetworkStatus, query);
|
|
5554
5562
|
};
|
|
5555
5563
|
ObservableQuery.prototype.updatePolling = function () {
|
|
5556
5564
|
var _this = this;
|
|
@@ -5732,25 +5740,62 @@ var ObservableQuery = (function (_super) {
|
|
|
5732
5740
|
id: this.queryId,
|
|
5733
5741
|
}) }) : result;
|
|
5734
5742
|
};
|
|
5743
|
+
ObservableQuery.prototype.resetNotifications = function () {
|
|
5744
|
+
this.cancelNotifyTimeout();
|
|
5745
|
+
this.dirty = false;
|
|
5746
|
+
};
|
|
5747
|
+
ObservableQuery.prototype.cancelNotifyTimeout = function () {
|
|
5748
|
+
if (this.notifyTimeout) {
|
|
5749
|
+
clearTimeout(this.notifyTimeout);
|
|
5750
|
+
this.notifyTimeout = void 0;
|
|
5751
|
+
}
|
|
5752
|
+
};
|
|
5753
|
+
ObservableQuery.prototype.scheduleNotify = function () {
|
|
5754
|
+
var _this = this;
|
|
5755
|
+
if (this.dirty)
|
|
5756
|
+
return;
|
|
5757
|
+
this.dirty = true;
|
|
5758
|
+
if (!this.notifyTimeout) {
|
|
5759
|
+
this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);
|
|
5760
|
+
}
|
|
5761
|
+
};
|
|
5762
|
+
ObservableQuery.prototype.notify = function () {
|
|
5763
|
+
this.cancelNotifyTimeout();
|
|
5764
|
+
if (this.dirty) {
|
|
5765
|
+
if (this.options.fetchPolicy == "cache-only" ||
|
|
5766
|
+
this.options.fetchPolicy == "cache-and-network" ||
|
|
5767
|
+
!isNetworkRequestInFlight(this.queryInfo.networkStatus)) {
|
|
5768
|
+
var diff = this.queryInfo.getDiff();
|
|
5769
|
+
if (diff.fromOptimisticTransaction) {
|
|
5770
|
+
this.observe();
|
|
5771
|
+
}
|
|
5772
|
+
else {
|
|
5773
|
+
this.reobserveCacheFirst();
|
|
5774
|
+
}
|
|
5775
|
+
}
|
|
5776
|
+
}
|
|
5777
|
+
this.dirty = false;
|
|
5778
|
+
};
|
|
5779
|
+
ObservableQuery.prototype.reobserveCacheFirst = function () {
|
|
5780
|
+
var _a = this.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy;
|
|
5781
|
+
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
5782
|
+
return this.reobserve({
|
|
5783
|
+
fetchPolicy: "cache-first",
|
|
5784
|
+
nextFetchPolicy: function (currentFetchPolicy, context) {
|
|
5785
|
+
this.nextFetchPolicy = nextFetchPolicy;
|
|
5786
|
+
if (typeof this.nextFetchPolicy === "function") {
|
|
5787
|
+
return this.nextFetchPolicy(currentFetchPolicy, context);
|
|
5788
|
+
}
|
|
5789
|
+
return fetchPolicy;
|
|
5790
|
+
},
|
|
5791
|
+
});
|
|
5792
|
+
}
|
|
5793
|
+
return this.reobserve();
|
|
5794
|
+
};
|
|
5795
|
+
ObservableQuery.inactiveOnCreation = new optimism.Slot();
|
|
5735
5796
|
return ObservableQuery;
|
|
5736
5797
|
}(zenObservableTs.Observable));
|
|
5737
5798
|
fixObservableSubclass(ObservableQuery);
|
|
5738
|
-
function reobserveCacheFirst(obsQuery) {
|
|
5739
|
-
var _a = obsQuery.options, fetchPolicy = _a.fetchPolicy, nextFetchPolicy = _a.nextFetchPolicy;
|
|
5740
|
-
if (fetchPolicy === "cache-and-network" || fetchPolicy === "network-only") {
|
|
5741
|
-
return obsQuery.reobserve({
|
|
5742
|
-
fetchPolicy: "cache-first",
|
|
5743
|
-
nextFetchPolicy: function (currentFetchPolicy, context) {
|
|
5744
|
-
this.nextFetchPolicy = nextFetchPolicy;
|
|
5745
|
-
if (typeof this.nextFetchPolicy === "function") {
|
|
5746
|
-
return this.nextFetchPolicy(currentFetchPolicy, context);
|
|
5747
|
-
}
|
|
5748
|
-
return fetchPolicy;
|
|
5749
|
-
},
|
|
5750
|
-
});
|
|
5751
|
-
}
|
|
5752
|
-
return obsQuery.reobserve();
|
|
5753
|
-
}
|
|
5754
5799
|
function defaultSubscriptionObserverErrorCallback(error) {
|
|
5755
5800
|
globalThis.__DEV__ !== false && invariant.error(25, error.message, error.stack);
|
|
5756
5801
|
}
|
|
@@ -5776,21 +5821,13 @@ function wrapDestructiveCacheMethod(cache, methodName) {
|
|
|
5776
5821
|
};
|
|
5777
5822
|
}
|
|
5778
5823
|
}
|
|
5779
|
-
function cancelNotifyTimeout(info) {
|
|
5780
|
-
if (info["notifyTimeout"]) {
|
|
5781
|
-
clearTimeout(info["notifyTimeout"]);
|
|
5782
|
-
info["notifyTimeout"] = void 0;
|
|
5783
|
-
}
|
|
5784
|
-
}
|
|
5785
5824
|
var QueryInfo = (function () {
|
|
5786
5825
|
function QueryInfo(queryManager, queryId) {
|
|
5787
5826
|
if (queryId === void 0) { queryId = queryManager.generateQueryId(); }
|
|
5788
5827
|
this.queryId = queryId;
|
|
5789
|
-
this.listeners = new Set();
|
|
5790
5828
|
this.document = null;
|
|
5791
5829
|
this.lastRequestId = 1;
|
|
5792
5830
|
this.stopped = false;
|
|
5793
|
-
this.dirty = false;
|
|
5794
5831
|
this.observableQuery = null;
|
|
5795
5832
|
var cache = (this.cache = queryManager.cache);
|
|
5796
5833
|
if (!destructiveMethodCounts.has(cache)) {
|
|
@@ -5826,10 +5863,6 @@ var QueryInfo = (function () {
|
|
|
5826
5863
|
}
|
|
5827
5864
|
return this;
|
|
5828
5865
|
};
|
|
5829
|
-
QueryInfo.prototype.reset = function () {
|
|
5830
|
-
cancelNotifyTimeout(this);
|
|
5831
|
-
this.dirty = false;
|
|
5832
|
-
};
|
|
5833
5866
|
QueryInfo.prototype.resetDiff = function () {
|
|
5834
5867
|
this.lastDiff = void 0;
|
|
5835
5868
|
};
|
|
@@ -5868,68 +5901,29 @@ var QueryInfo = (function () {
|
|
|
5868
5901
|
};
|
|
5869
5902
|
};
|
|
5870
5903
|
QueryInfo.prototype.setDiff = function (diff) {
|
|
5871
|
-
var
|
|
5872
|
-
var _a;
|
|
5904
|
+
var _a, _b;
|
|
5873
5905
|
var oldDiff = this.lastDiff && this.lastDiff.diff;
|
|
5874
5906
|
if (diff && !diff.complete && ((_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a.getLastError())) {
|
|
5875
5907
|
return;
|
|
5876
5908
|
}
|
|
5877
5909
|
this.updateLastDiff(diff);
|
|
5878
|
-
if (!
|
|
5879
|
-
this.
|
|
5880
|
-
if (!this.notifyTimeout) {
|
|
5881
|
-
this.notifyTimeout = setTimeout(function () { return _this.notify(); }, 0);
|
|
5882
|
-
}
|
|
5910
|
+
if (!equal.equal(oldDiff && oldDiff.result, diff && diff.result)) {
|
|
5911
|
+
(_b = this.observableQuery) === null || _b === void 0 ? void 0 : _b["scheduleNotify"]();
|
|
5883
5912
|
}
|
|
5884
5913
|
};
|
|
5885
5914
|
QueryInfo.prototype.setObservableQuery = function (oq) {
|
|
5886
|
-
var _this = this;
|
|
5887
5915
|
if (oq === this.observableQuery)
|
|
5888
5916
|
return;
|
|
5889
|
-
if (this.oqListener) {
|
|
5890
|
-
this.listeners.delete(this.oqListener);
|
|
5891
|
-
}
|
|
5892
5917
|
this.observableQuery = oq;
|
|
5893
5918
|
if (oq) {
|
|
5894
5919
|
oq["queryInfo"] = this;
|
|
5895
|
-
this.listeners.add((this.oqListener = function () {
|
|
5896
|
-
var diff = _this.getDiff();
|
|
5897
|
-
if (diff.fromOptimisticTransaction) {
|
|
5898
|
-
oq["observe"]();
|
|
5899
|
-
}
|
|
5900
|
-
else {
|
|
5901
|
-
reobserveCacheFirst(oq);
|
|
5902
|
-
}
|
|
5903
|
-
}));
|
|
5904
|
-
}
|
|
5905
|
-
else {
|
|
5906
|
-
delete this.oqListener;
|
|
5907
|
-
}
|
|
5908
|
-
};
|
|
5909
|
-
QueryInfo.prototype.notify = function () {
|
|
5910
|
-
var _this = this;
|
|
5911
|
-
cancelNotifyTimeout(this);
|
|
5912
|
-
if (this.shouldNotify()) {
|
|
5913
|
-
this.listeners.forEach(function (listener) { return listener(_this); });
|
|
5914
|
-
}
|
|
5915
|
-
this.dirty = false;
|
|
5916
|
-
};
|
|
5917
|
-
QueryInfo.prototype.shouldNotify = function () {
|
|
5918
|
-
if (!this.dirty || !this.listeners.size) {
|
|
5919
|
-
return false;
|
|
5920
|
-
}
|
|
5921
|
-
if (isNetworkRequestInFlight(this.networkStatus) && this.observableQuery) {
|
|
5922
|
-
var fetchPolicy = this.observableQuery.options.fetchPolicy;
|
|
5923
|
-
if (fetchPolicy !== "cache-only" && fetchPolicy !== "cache-and-network") {
|
|
5924
|
-
return false;
|
|
5925
|
-
}
|
|
5926
5920
|
}
|
|
5927
|
-
return true;
|
|
5928
5921
|
};
|
|
5929
5922
|
QueryInfo.prototype.stop = function () {
|
|
5923
|
+
var _a;
|
|
5930
5924
|
if (!this.stopped) {
|
|
5931
5925
|
this.stopped = true;
|
|
5932
|
-
this.
|
|
5926
|
+
(_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a["resetNotifications"]();
|
|
5933
5927
|
this.cancel();
|
|
5934
5928
|
var oq = this.observableQuery;
|
|
5935
5929
|
if (oq)
|
|
@@ -5966,9 +5960,10 @@ var QueryInfo = (function () {
|
|
|
5966
5960
|
};
|
|
5967
5961
|
QueryInfo.prototype.markResult = function (result, document, options, cacheWriteBehavior) {
|
|
5968
5962
|
var _this = this;
|
|
5963
|
+
var _a;
|
|
5969
5964
|
var merger = new DeepMerger();
|
|
5970
5965
|
var graphQLErrors = isNonEmptyArray(result.errors) ? result.errors.slice(0) : [];
|
|
5971
|
-
this.
|
|
5966
|
+
(_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a["resetNotifications"]();
|
|
5972
5967
|
if ("incremental" in result && isNonEmptyArray(result.incremental)) {
|
|
5973
5968
|
var mergedData = mergeIncrementalData(this.getDiff().result, result);
|
|
5974
5969
|
result.data = mergedData;
|
|
@@ -6024,9 +6019,10 @@ var QueryInfo = (function () {
|
|
|
6024
6019
|
return (this.networkStatus = exports.NetworkStatus.ready);
|
|
6025
6020
|
};
|
|
6026
6021
|
QueryInfo.prototype.markError = function (error) {
|
|
6022
|
+
var _a;
|
|
6027
6023
|
this.networkStatus = exports.NetworkStatus.error;
|
|
6028
6024
|
this.lastWrite = void 0;
|
|
6029
|
-
this.
|
|
6025
|
+
(_a = this.observableQuery) === null || _a === void 0 ? void 0 : _a["resetNotifications"]();
|
|
6030
6026
|
if (error.graphQLErrors) {
|
|
6031
6027
|
this.graphQLErrors = error.graphQLErrors;
|
|
6032
6028
|
}
|
|
@@ -6354,8 +6350,7 @@ var QueryManager = (function () {
|
|
|
6354
6350
|
return true;
|
|
6355
6351
|
};
|
|
6356
6352
|
QueryManager.prototype.fetchQuery = function (queryId, options, networkStatus) {
|
|
6357
|
-
return this.fetchConcastWithInfo(queryId, options, networkStatus).concast
|
|
6358
|
-
.promise;
|
|
6353
|
+
return this.fetchConcastWithInfo(this.getOrCreateQuery(queryId), options, networkStatus).concast.promise;
|
|
6359
6354
|
};
|
|
6360
6355
|
QueryManager.prototype.getQueryStore = function () {
|
|
6361
6356
|
var store = Object.create(null);
|
|
@@ -6423,7 +6418,9 @@ var QueryManager = (function () {
|
|
|
6423
6418
|
options: options,
|
|
6424
6419
|
});
|
|
6425
6420
|
observable["lastQuery"] = query;
|
|
6426
|
-
|
|
6421
|
+
if (!ObservableQuery["inactiveOnCreation"].getValue()) {
|
|
6422
|
+
this.queries.set(observable.queryId, queryInfo);
|
|
6423
|
+
}
|
|
6427
6424
|
queryInfo.init({
|
|
6428
6425
|
document: query,
|
|
6429
6426
|
observableQuery: observable,
|
|
@@ -6535,7 +6532,7 @@ var QueryManager = (function () {
|
|
|
6535
6532
|
if (legacyQueryOptions.size) {
|
|
6536
6533
|
legacyQueryOptions.forEach(function (options) {
|
|
6537
6534
|
var queryId = makeUniqueId("legacyOneTimeQuery");
|
|
6538
|
-
var queryInfo = _this.
|
|
6535
|
+
var queryInfo = _this.getOrCreateQuery(queryId).init({
|
|
6539
6536
|
document: options.query,
|
|
6540
6537
|
variables: options.variables,
|
|
6541
6538
|
});
|
|
@@ -6575,14 +6572,11 @@ var QueryManager = (function () {
|
|
|
6575
6572
|
(fetchPolicy !== "standby" && fetchPolicy !== "cache-only")) {
|
|
6576
6573
|
observableQueryPromises.push(observableQuery.refetch());
|
|
6577
6574
|
}
|
|
6578
|
-
_this.
|
|
6575
|
+
(_this.queries.get(queryId) || observableQuery["queryInfo"]).setDiff(null);
|
|
6579
6576
|
});
|
|
6580
6577
|
this.broadcastQueries();
|
|
6581
6578
|
return Promise.all(observableQueryPromises);
|
|
6582
6579
|
};
|
|
6583
|
-
QueryManager.prototype.setObservableQuery = function (observableQuery) {
|
|
6584
|
-
this.getQuery(observableQuery.queryId).setObservableQuery(observableQuery);
|
|
6585
|
-
};
|
|
6586
6580
|
QueryManager.prototype.startGraphQLSubscription = function (options) {
|
|
6587
6581
|
var _this = this;
|
|
6588
6582
|
var query = options.query, variables = options.variables;
|
|
@@ -6643,16 +6637,17 @@ var QueryManager = (function () {
|
|
|
6643
6637
|
this.removeQuery(queryId);
|
|
6644
6638
|
};
|
|
6645
6639
|
QueryManager.prototype.removeQuery = function (queryId) {
|
|
6640
|
+
var _a;
|
|
6646
6641
|
this.fetchCancelFns.delete(queryId);
|
|
6647
6642
|
if (this.queries.has(queryId)) {
|
|
6648
|
-
this.
|
|
6643
|
+
(_a = this.queries.get(queryId)) === null || _a === void 0 ? void 0 : _a.stop();
|
|
6649
6644
|
this.queries.delete(queryId);
|
|
6650
6645
|
}
|
|
6651
6646
|
};
|
|
6652
6647
|
QueryManager.prototype.broadcastQueries = function () {
|
|
6653
6648
|
if (this.onBroadcast)
|
|
6654
6649
|
this.onBroadcast();
|
|
6655
|
-
this.queries.forEach(function (info) { return info.notify(); });
|
|
6650
|
+
this.queries.forEach(function (info) { var _a; return (_a = info.observableQuery) === null || _a === void 0 ? void 0 : _a["notify"](); });
|
|
6656
6651
|
};
|
|
6657
6652
|
QueryManager.prototype.getLocalState = function () {
|
|
6658
6653
|
return this.localState;
|
|
@@ -6753,13 +6748,12 @@ var QueryManager = (function () {
|
|
|
6753
6748
|
throw error;
|
|
6754
6749
|
});
|
|
6755
6750
|
};
|
|
6756
|
-
QueryManager.prototype.fetchConcastWithInfo = function (
|
|
6751
|
+
QueryManager.prototype.fetchConcastWithInfo = function (queryInfo, options,
|
|
6757
6752
|
networkStatus, query) {
|
|
6758
6753
|
var _this = this;
|
|
6759
6754
|
if (networkStatus === void 0) { networkStatus = exports.NetworkStatus.loading; }
|
|
6760
6755
|
if (query === void 0) { query = options.query; }
|
|
6761
6756
|
var variables = this.getVariables(query, options.variables);
|
|
6762
|
-
var queryInfo = this.getQuery(queryId);
|
|
6763
6757
|
var defaults = this.defaultOptions.watchQuery;
|
|
6764
6758
|
var _a = options.fetchPolicy, fetchPolicy = _a === void 0 ? (defaults && defaults.fetchPolicy) || "cache-first" : _a, _b = options.errorPolicy, errorPolicy = _b === void 0 ? (defaults && defaults.errorPolicy) || "none" : _b, _c = options.returnPartialData, returnPartialData = _c === void 0 ? false : _c, _d = options.notifyOnNetworkStatusChange, notifyOnNetworkStatusChange = _d === void 0 ? false : _d, _e = options.context, context = _e === void 0 ? {} : _e;
|
|
6765
6759
|
var normalized = Object.assign({}, options, {
|
|
@@ -6782,8 +6776,8 @@ var QueryManager = (function () {
|
|
|
6782
6776
|
}
|
|
6783
6777
|
return sourcesWithInfo;
|
|
6784
6778
|
};
|
|
6785
|
-
var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryId); };
|
|
6786
|
-
this.fetchCancelFns.set(queryId, function (reason) {
|
|
6779
|
+
var cleanupCancelFn = function () { return _this.fetchCancelFns.delete(queryInfo.queryId); };
|
|
6780
|
+
this.fetchCancelFns.set(queryInfo.queryId, function (reason) {
|
|
6787
6781
|
cleanupCancelFn();
|
|
6788
6782
|
setTimeout(function () { return concast.cancel(reason); });
|
|
6789
6783
|
});
|
|
@@ -6814,7 +6808,7 @@ var QueryManager = (function () {
|
|
|
6814
6808
|
this.getObservableQueries(include).forEach(function (oq, queryId) {
|
|
6815
6809
|
includedQueriesById.set(queryId, {
|
|
6816
6810
|
oq: oq,
|
|
6817
|
-
lastDiff: _this.
|
|
6811
|
+
lastDiff: (_this.queries.get(queryId) || oq["queryInfo"]).getDiff(),
|
|
6818
6812
|
});
|
|
6819
6813
|
});
|
|
6820
6814
|
}
|
|
@@ -6851,9 +6845,7 @@ var QueryManager = (function () {
|
|
|
6851
6845
|
var result;
|
|
6852
6846
|
if (onQueryUpdated) {
|
|
6853
6847
|
if (!diff) {
|
|
6854
|
-
|
|
6855
|
-
info.reset();
|
|
6856
|
-
diff = info.getDiff();
|
|
6848
|
+
diff = _this.cache.diff(oq["queryInfo"]["getDiffOptions"]());
|
|
6857
6849
|
}
|
|
6858
6850
|
result = onQueryUpdated(oq, diff, lastDiff);
|
|
6859
6851
|
}
|
|
@@ -7010,7 +7002,7 @@ var QueryManager = (function () {
|
|
|
7010
7002
|
return { fromLink: false, sources: [] };
|
|
7011
7003
|
}
|
|
7012
7004
|
};
|
|
7013
|
-
QueryManager.prototype.
|
|
7005
|
+
QueryManager.prototype.getOrCreateQuery = function (queryId) {
|
|
7014
7006
|
if (queryId && !this.queries.has(queryId)) {
|
|
7015
7007
|
this.queries.set(queryId, new QueryInfo(this, queryId));
|
|
7016
7008
|
}
|
|
@@ -7901,7 +7893,9 @@ function useInternalState(client, query, options, renderPromises, makeWatchQuery
|
|
|
7901
7893
|
observable:
|
|
7902
7894
|
(renderPromises &&
|
|
7903
7895
|
renderPromises.getSSRObservable(makeWatchQueryOptions())) ||
|
|
7904
|
-
|
|
7896
|
+
ObservableQuery["inactiveOnCreation"].withValue(!renderPromises, function () {
|
|
7897
|
+
return client.watchQuery(getObsQueryOptions(void 0, client, options, makeWatchQueryOptions()));
|
|
7898
|
+
}),
|
|
7905
7899
|
resultData: {
|
|
7906
7900
|
previousData: (_a = previous === null || previous === void 0 ? void 0 : previous.resultData.current) === null || _a === void 0 ? void 0 : _a.data,
|
|
7907
7901
|
},
|