relay-runtime 0.0.0-main-e1456f7f → 0.0.0-main-b2b07a6f
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/experimental.js
CHANGED
package/index.js
CHANGED
|
@@ -84,6 +84,7 @@ var Executor = /*#__PURE__*/function () {
|
|
|
84
84
|
this._seenActors = new Set();
|
|
85
85
|
this._completeFns = [];
|
|
86
86
|
this._normalizeResponse = normalizeResponse;
|
|
87
|
+
this._isClientQuery = this._operation.request.node.params.id == null && this._operation.request.node.params.text == null;
|
|
87
88
|
var id = this._nextSubscriptionId++;
|
|
88
89
|
if (RelayFeatureFlags.PROCESS_OPTIMISTIC_UPDATE_BEFORE_SUBSCRIPTION && optimisticConfig != null) {
|
|
89
90
|
this._processOptimisticResponse(optimisticConfig.response != null ? {
|
|
@@ -375,6 +376,9 @@ var Executor = /*#__PURE__*/function () {
|
|
|
375
376
|
_payloadFollowups.push(payload);
|
|
376
377
|
this._execTimeResolverResponseComplete = isFinal;
|
|
377
378
|
if (isFinal) {
|
|
379
|
+
if (this._isClientQuery) {
|
|
380
|
+
this._state = 'loading_final';
|
|
381
|
+
}
|
|
378
382
|
this._updateActiveState();
|
|
379
383
|
}
|
|
380
384
|
}
|
|
@@ -43,10 +43,11 @@ function _waitForFragmentData() {
|
|
|
43
43
|
return _waitForFragmentData.apply(this, arguments);
|
|
44
44
|
}
|
|
45
45
|
function observeFragment(environment, fragment, fragmentRef) {
|
|
46
|
-
var _fragmentNode$metadat;
|
|
46
|
+
var _fragmentSelector$own, _fragmentSelector$own2, _fragmentSelector$own3, _fragmentSelector$own4, _fragmentSelector$own5, _fragmentSelector$own6, _fragmentSelector$own7, _fragmentSelector$own8, _fragmentNode$metadat;
|
|
47
47
|
var fragmentNode = getFragment(fragment);
|
|
48
48
|
var fragmentSelector = getSelector(fragmentNode, fragmentRef);
|
|
49
|
-
|
|
49
|
+
var usesExecTimeResolver = (_fragmentSelector$own = fragmentSelector === null || fragmentSelector === void 0 ? void 0 : (_fragmentSelector$own2 = fragmentSelector.owner) === null || _fragmentSelector$own2 === void 0 ? void 0 : (_fragmentSelector$own3 = _fragmentSelector$own2.node) === null || _fragmentSelector$own3 === void 0 ? void 0 : (_fragmentSelector$own4 = _fragmentSelector$own3.operation) === null || _fragmentSelector$own4 === void 0 ? void 0 : _fragmentSelector$own4.use_exec_time_resolvers) !== null && _fragmentSelector$own !== void 0 ? _fragmentSelector$own : fragmentSelector === null || fragmentSelector === void 0 ? void 0 : (_fragmentSelector$own5 = fragmentSelector.owner) === null || _fragmentSelector$own5 === void 0 ? void 0 : (_fragmentSelector$own6 = _fragmentSelector$own5.node) === null || _fragmentSelector$own6 === void 0 ? void 0 : (_fragmentSelector$own7 = _fragmentSelector$own6.operation) === null || _fragmentSelector$own7 === void 0 ? void 0 : (_fragmentSelector$own8 = _fragmentSelector$own7.exec_time_resolvers_enabled_provider) === null || _fragmentSelector$own8 === void 0 ? void 0 : _fragmentSelector$own8.get();
|
|
50
|
+
!(usesExecTimeResolver === true || ((_fragmentNode$metadat = fragmentNode.metadata) === null || _fragmentNode$metadat === void 0 ? void 0 : _fragmentNode$metadat.hasClientEdges) == null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Client edges aren't supported yet.") : invariant(false) : void 0;
|
|
50
51
|
!(fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Expected a selector, got null.') : invariant(false) : void 0;
|
|
51
52
|
switch (fragmentSelector.kind) {
|
|
52
53
|
case 'SingularReaderSelector':
|
package/package.json
CHANGED
|
@@ -160,6 +160,7 @@ class Executor<TMutation: MutationParameters> {
|
|
|
160
160
|
+_seenActors: Set<ActorIdentifier>;
|
|
161
161
|
_normalizeResponse: NormalizeResponseFunction;
|
|
162
162
|
_execTimeResolverResponseComplete: boolean;
|
|
163
|
+
_isClientQuery: boolean;
|
|
163
164
|
|
|
164
165
|
constructor({
|
|
165
166
|
actorIdentifier,
|
|
@@ -218,6 +219,9 @@ class Executor<TMutation: MutationParameters> {
|
|
|
218
219
|
this._seenActors = new Set();
|
|
219
220
|
this._completeFns = [];
|
|
220
221
|
this._normalizeResponse = normalizeResponse;
|
|
222
|
+
this._isClientQuery =
|
|
223
|
+
this._operation.request.node.params.id == null &&
|
|
224
|
+
this._operation.request.node.params.text == null;
|
|
221
225
|
|
|
222
226
|
const id = this._nextSubscriptionId++;
|
|
223
227
|
|
|
@@ -590,6 +594,11 @@ class Executor<TMutation: MutationParameters> {
|
|
|
590
594
|
if (isFinal) {
|
|
591
595
|
// Need to update the active state to mark the query as inactive,
|
|
592
596
|
// incase server payloads have completed
|
|
597
|
+
if (this._isClientQuery) {
|
|
598
|
+
// If it is a client query, there is no server response to set the
|
|
599
|
+
// final state, so we need to set it here
|
|
600
|
+
this._state = 'loading_final';
|
|
601
|
+
}
|
|
593
602
|
this._updateActiveState();
|
|
594
603
|
}
|
|
595
604
|
}
|
|
@@ -119,8 +119,13 @@ function observeFragment<TFragmentType: FragmentType, TData>(
|
|
|
119
119
|
): mixed {
|
|
120
120
|
const fragmentNode = getFragment(fragment);
|
|
121
121
|
const fragmentSelector = getSelector(fragmentNode, fragmentRef);
|
|
122
|
+
const usesExecTimeResolver =
|
|
123
|
+
fragmentSelector?.owner?.node?.operation?.use_exec_time_resolvers ??
|
|
124
|
+
fragmentSelector?.owner?.node?.operation?.exec_time_resolvers_enabled_provider?.get();
|
|
125
|
+
|
|
122
126
|
invariant(
|
|
123
|
-
|
|
127
|
+
usesExecTimeResolver === true ||
|
|
128
|
+
fragmentNode.metadata?.hasClientEdges == null,
|
|
124
129
|
"Client edges aren't supported yet.",
|
|
125
130
|
);
|
|
126
131
|
invariant(fragmentSelector != null, 'Expected a selector, got null.');
|