relay-runtime 0.0.0-main-1ac62c2b → 0.0.0-main-716164ec

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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-1ac62c2b
2
+ * Relay v0.0.0-main-716164ec
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-1ac62c2b
2
+ * Relay v0.0.0-main-716164ec
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -328,9 +328,20 @@ var Executor = /*#__PURE__*/function () {
328
328
  return ((_x$extensions = x.extensions) === null || _x$extensions === void 0 ? void 0 : _x$extensions.is_final) === true;
329
329
  });
330
330
  if (isFinal) {
331
- this._state = 'loading_final';
332
- this._updateActiveState();
333
- this._incrementalPayloadsPending = false;
331
+ if (this._useExecTimeResolvers && this._state !== 'loading_final' && responses.some(function (x) {
332
+ var _x$extensions2;
333
+ return ((_x$extensions2 = x.extensions) === null || _x$extensions2 === void 0 ? void 0 : _x$extensions2.is_normalized) === true;
334
+ })) {
335
+ this._execTimeResolverResponseComplete = true;
336
+ if (this._isClientQuery) {
337
+ this._state = 'loading_final';
338
+ }
339
+ this._updateActiveState();
340
+ } else {
341
+ this._state = 'loading_final';
342
+ this._updateActiveState();
343
+ this._incrementalPayloadsPending = false;
344
+ }
334
345
  }
335
346
  this._sink.next(response);
336
347
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "relay-runtime",
3
3
  "description": "A core runtime for building GraphQL-driven applications.",
4
- "version": "0.0.0-main-1ac62c2b",
4
+ "version": "0.0.0-main-716164ec",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay"
@@ -515,12 +515,32 @@ class Executor<TMutation: MutationParameters> {
515
515
 
516
516
  if (responsesWithData.length === 0) {
517
517
  // no results with data, nothing to process
518
- // this can occur with extensions-only payloads
518
+ // this can occur with extensions-only payloads, or exec time resolver
519
+ // responses
519
520
  const isFinal = responses.some(x => x.extensions?.is_final === true);
520
521
  if (isFinal) {
521
- this._state = 'loading_final';
522
- this._updateActiveState();
523
- this._incrementalPayloadsPending = false;
522
+ if (
523
+ this._useExecTimeResolvers &&
524
+ this._state !== 'loading_final' &&
525
+ responses.some(x => x.extensions?.is_normalized === true)
526
+ ) {
527
+ // An exec time resolver query can flush an empty response, if the
528
+ // same response has been included in other queries. Check if we need
529
+ // to mark the request as final
530
+ this._execTimeResolverResponseComplete = true;
531
+ // Need to update the active state to mark the query as inactive,
532
+ // incase server payloads have completed
533
+ if (this._isClientQuery) {
534
+ // If it is a client query, there is no server response to set the
535
+ // final state, so we need to set it here
536
+ this._state = 'loading_final';
537
+ }
538
+ this._updateActiveState();
539
+ } else {
540
+ this._state = 'loading_final';
541
+ this._updateActiveState();
542
+ this._incrementalPayloadsPending = false;
543
+ }
524
544
  }
525
545
  this._sink.next(response);
526
546
  return;