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.
- package/ReactRelayContext.js +1 -1
- package/hooks.js +1 -1
- package/index.js +1 -1
- package/legacy.js +1 -1
- package/lib/relay-hooks/useFragmentInternal_EXPERIMENTAL.js +14 -4
- package/package.json +2 -2
- package/relay-hooks/useFragmentInternal_EXPERIMENTAL.js.flow +24 -7
- package/rsc-client_EXPERIMENTAL.js +1 -1
- package/rsc_EXPERIMENTAL.js +1 -1
package/ReactRelayContext.js
CHANGED
package/hooks.js
CHANGED
package/index.js
CHANGED
package/legacy.js
CHANGED
|
@@ -431,10 +431,20 @@ function useFragmentInternal_EXPERIMENTAL(fragmentNode, fragmentRef, hookDisplay
|
|
|
431
431
|
isMount: committedFragmentSelectorRef.current === false,
|
|
432
432
|
suspendingLiveResolvers: suspendingLiveResolvers
|
|
433
433
|
});
|
|
434
|
-
var
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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-
|
|
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-
|
|
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
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
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 = '
|
|
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
|
package/rsc_EXPERIMENTAL.js
CHANGED