react-relay 0.0.0-main-a4e82e93 → 0.0.0-main-5c3febad

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-a4e82e93
2
+ * Relay v0.0.0-main-5c3febad
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-a4e82e93
2
+ * Relay v0.0.0-main-5c3febad
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-a4e82e93
2
+ * Relay v0.0.0-main-5c3febad
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/legacy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-a4e82e93
2
+ * Relay v0.0.0-main-5c3febad
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -431,10 +431,20 @@ function useFragmentInternal_EXPERIMENTAL(fragmentNode, fragmentRef, hookDisplay
431
431
  isMount: committedFragmentSelectorRef.current === false,
432
432
  suspendingLiveResolvers: suspendingLiveResolvers
433
433
  });
434
- var promise = Promise.all(suspendingLiveResolvers.map(function (liveStateID) {
435
- return environment.getStore().getLiveResolverPromise(liveStateID);
436
- }));
437
- promise.displayName = 'RelayLiveResolver(' + fragmentNode.name + ')';
434
+ var store = environment.getStore();
435
+ var promises = suspendingLiveResolvers.map(function (liveStateID) {
436
+ return store.getLiveResolverPromise(liveStateID);
437
+ });
438
+ var described = '';
439
+ for (var i = 0; i < promises.length; i++) {
440
+ var liveStateName = promises[i].displayName;
441
+ if (liveStateName != null && liveStateName !== '') {
442
+ described = described === '' ? liveStateName : described + ',' + liveStateName;
443
+ }
444
+ }
445
+ var promise = Promise.all(promises);
446
+ var name = 'RelayLiveResolver(' + fragmentNode.name + ')';
447
+ promise.displayName = described === '' ? name : name + ' <- ' + described;
438
448
  throw promise;
439
449
  }
440
450
  if (RelayFeatureFlags.ENABLE_RELAY_OPERATION_TRACKER_SUSPENSE || environment !== previousEnvironment || committedFragmentSelectorRef.current === false || !areEqualSelectors(committedFragmentSelectorRef.current, fragmentSelector)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-relay",
3
3
  "description": "A framework for building GraphQL-driven React applications.",
4
- "version": "0.0.0-main-a4e82e93",
4
+ "version": "0.0.0-main-5c3febad",
5
5
  "keywords": [
6
6
  "graphql",
7
7
  "relay",
@@ -20,7 +20,7 @@
20
20
  "fbjs": "^3.0.2",
21
21
  "invariant": "^2.2.4",
22
22
  "nullthrows": "^1.1.1",
23
- "relay-runtime": "0.0.0-main-a4e82e93"
23
+ "relay-runtime": "0.0.0-main-5c3febad"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^16.9.0 || ^17 || ^18 || ^19"
@@ -577,14 +577,31 @@ hook useFragmentInternal_EXPERIMENTAL(
577
577
  isMount: committedFragmentSelectorRef.current === false,
578
578
  suspendingLiveResolvers,
579
579
  });
580
- const promise = Promise.all(
581
- suspendingLiveResolvers.map(liveStateID => {
582
- // $FlowFixMe[prop-missing] This is expected to be a RelayModernStore
583
- return environment.getStore().getLiveResolverPromise(liveStateID);
584
- }),
585
- );
580
+ const store = environment.getStore();
581
+ const promises = suspendingLiveResolvers.map(liveStateID => {
582
+ // $FlowFixMe[prop-missing] This is expected to be a RelayModernStore
583
+ return store.getLiveResolverPromise(liveStateID);
584
+ });
585
+ // `Promise.all` yields a new promise, so the names already set on the
586
+ // promises it wraps are lost. Fold them into this one. Built with a loop
587
+ // and string concatenation rather than filter/join: this runs on every
588
+ // suspending read, and the intermediate array is the expensive part.
589
+ let described = '';
590
+ for (let i = 0; i < promises.length; i++) {
591
+ // $FlowFixMe[prop-missing] Expando to annotate Promises.
592
+ const liveStateName: ?string = promises[i].displayName;
593
+ if (liveStateName != null && liveStateName !== '') {
594
+ described =
595
+ described === '' ? liveStateName : described + ',' + liveStateName;
596
+ }
597
+ }
598
+ const promise = Promise.all(promises);
599
+ // Appended, not substituted: the `RelayLiveResolver(<fragment>)` form is
600
+ // pattern-matched by profiling tools, and it is the only part that says
601
+ // where the spinner rendered.
602
+ const name = 'RelayLiveResolver(' + fragmentNode.name + ')';
586
603
  // $FlowExpectedError[prop-missing] Expando to annotate Promises.
587
- promise.displayName = 'RelayLiveResolver(' + fragmentNode.name + ')';
604
+ promise.displayName = described === '' ? name : name + ' <- ' + described;
588
605
  throw promise;
589
606
  }
590
607
  // Suspend if an active operation bears on this fragment, either the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-a4e82e93
2
+ * Relay v0.0.0-main-5c3febad
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-a4e82e93
2
+ * Relay v0.0.0-main-5c3febad
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *