react-relay 0.0.0-main-2b85d374 → 0.0.0-main-5ec796e4

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-2b85d374
2
+ * Relay v0.0.0-main-5ec796e4
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-2b85d374
2
+ * Relay v0.0.0-main-5ec796e4
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-2b85d374
2
+ * Relay v0.0.0-main-5ec796e4
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-2b85d374
2
+ * Relay v0.0.0-main-5ec796e4
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -199,7 +199,11 @@ function handleMissingClientEdge(environment, parentFragmentNode, parentFragment
199
199
  var queryOperationDescriptor = createOperationDescriptor(missingClientEdgeRequestInfo.request, variables, queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.networkCacheConfig);
200
200
  var QueryResource = getQueryResourceForEnvironment(environment);
201
201
  var queryResult = QueryResource.prepare(queryOperationDescriptor, fetchQueryInternal(environment, queryOperationDescriptor), queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.fetchPolicy);
202
- return [queryResult, getPromiseForActiveRequest(environment, queryOperationDescriptor.request)];
202
+ var promise = getPromiseForActiveRequest(environment, queryOperationDescriptor.request);
203
+ if (promise != null && promise.displayName == null) {
204
+ promise.displayName = missingClientEdgeRequestInfo.request.params.name;
205
+ }
206
+ return [queryResult, promise];
203
207
  }
204
208
  function subscribeToSnapshot(environment, state, setState) {
205
209
  if (state.kind === 'bailout') {
@@ -376,7 +380,11 @@ function useFragmentInternal_EXPERIMENTAL(fragmentNode, fragmentRef, hookDisplay
376
380
  clientEdgeQueries = _useMemo[0],
377
381
  activeRequestPromises = _useMemo[1];
378
382
  if (activeRequestPromises.length) {
379
- throw Promise.all(activeRequestPromises);
383
+ var allPromises = Promise.all(activeRequestPromises);
384
+ allPromises.displayName = "RelayClientEdge(".concat(activeRequestPromises.map(function (promise) {
385
+ return promise.displayName;
386
+ }).join(','), ")");
387
+ throw allPromises;
380
388
  }
381
389
  useEffect(function () {
382
390
  var QueryResource = getQueryResourceForEnvironment(environment);
@@ -406,9 +414,11 @@ function useFragmentInternal_EXPERIMENTAL(fragmentNode, fragmentRef, hookDisplay
406
414
  if (isMissingData(state)) {
407
415
  var suspendingLiveResolvers = getSuspendingLiveResolver(state);
408
416
  if (suspendingLiveResolvers != null && suspendingLiveResolvers.length > 0) {
409
- throw Promise.all(suspendingLiveResolvers.map(function (liveStateID) {
417
+ var promise = Promise.all(suspendingLiveResolvers.map(function (liveStateID) {
410
418
  return environment.getStore().getLiveResolverPromise(liveStateID);
411
419
  }));
420
+ promise.displayName = 'RelayLiveResolver(' + fragmentNode.name + ')';
421
+ throw promise;
412
422
  }
413
423
  if (RelayFeatureFlags.ENABLE_RELAY_OPERATION_TRACKER_SUSPENSE || environment !== previousEnvironment || !committedFragmentSelectorRef.current || !areEqualSelectors(committedFragmentSelectorRef.current, fragmentSelector)) {
414
424
  !(fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'refinement, see invariants above') : invariant(false) : void 0;
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-2b85d374",
4
+ "version": "0.0.0-main-5ec796e4",
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-2b85d374"
23
+ "relay-runtime": "0.0.0-main-5ec796e4"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^16.9.0 || ^17 || ^18 || ^19"
@@ -222,13 +222,15 @@ function handleMissedUpdates(
222
222
  }
223
223
  }
224
224
 
225
+ type PromiseWithDisplayName = Promise<mixed> & {displayName?: string};
226
+
225
227
  function handleMissingClientEdge(
226
228
  environment: IEnvironment,
227
229
  parentFragmentNode: ReaderFragment,
228
230
  parentFragmentRef: mixed,
229
231
  missingClientEdgeRequestInfo: MissingClientEdgeRequestInfo,
230
232
  queryOptions?: FragmentQueryOptions,
231
- ): [QueryResult, ?Promise<mixed>] {
233
+ ): [QueryResult, ?PromiseWithDisplayName] {
232
234
  const originalVariables = getVariablesFromFragment(
233
235
  parentFragmentNode,
234
236
  parentFragmentRef,
@@ -253,10 +255,17 @@ function handleMissingClientEdge(
253
255
  queryOptions?.fetchPolicy,
254
256
  );
255
257
 
256
- return [
257
- queryResult,
258
- getPromiseForActiveRequest(environment, queryOperationDescriptor.request),
259
- ];
258
+ const promise = getPromiseForActiveRequest(
259
+ environment,
260
+ queryOperationDescriptor.request,
261
+ );
262
+ // $FlowExpectedError[prop-missing]
263
+ if (promise != null && promise.displayName == null) {
264
+ // $FlowExpectedError[prop-missing]
265
+ promise.displayName = missingClientEdgeRequestInfo.request.params.name;
266
+ }
267
+ // $FlowFixMe[incompatible-exact] - Intentionally bypassing exactness check
268
+ return [queryResult, promise];
260
269
  }
261
270
 
262
271
  function subscribeToSnapshot(
@@ -490,7 +499,7 @@ hook useFragmentInternal_EXPERIMENTAL(
490
499
  const missingClientEdges = getMissingClientEdges(state);
491
500
  // eslint-disable-next-line no-shadow
492
501
  let clientEdgeQueries;
493
- const activeRequestPromises = [];
502
+ const activeRequestPromises: Array<PromiseWithDisplayName> = [];
494
503
  if (missingClientEdges?.length) {
495
504
  clientEdgeQueries = ([]: Array<QueryResult>);
496
505
  for (const edge of missingClientEdges) {
@@ -511,7 +520,12 @@ hook useFragmentInternal_EXPERIMENTAL(
511
520
  }, [state, environment, fragmentNode, fragmentRef, queryOptions]);
512
521
 
513
522
  if (activeRequestPromises.length) {
514
- throw Promise.all(activeRequestPromises);
523
+ const allPromises = Promise.all(activeRequestPromises);
524
+ // $FlowExpectedError[prop-missing] Expando to annotate Promises.
525
+ allPromises.displayName = `RelayClientEdge(${activeRequestPromises
526
+ .map(promise => promise.displayName)
527
+ .join(',')})`;
528
+ throw allPromises;
515
529
  }
516
530
 
517
531
  // See above note
@@ -538,12 +552,15 @@ hook useFragmentInternal_EXPERIMENTAL(
538
552
  // Suspend if a Live Resolver within this fragment is in a suspended state:
539
553
  const suspendingLiveResolvers = getSuspendingLiveResolver(state);
540
554
  if (suspendingLiveResolvers != null && suspendingLiveResolvers.length > 0) {
541
- throw Promise.all(
555
+ const promise = Promise.all(
542
556
  suspendingLiveResolvers.map(liveStateID => {
543
557
  // $FlowFixMe[prop-missing] This is expected to be a RelayModernStore
544
558
  return environment.getStore().getLiveResolverPromise(liveStateID);
545
559
  }),
546
560
  );
561
+ // $FlowExpectedError[prop-missing] Expando to annotate Promises.
562
+ promise.displayName = 'RelayLiveResolver(' + fragmentNode.name + ')';
563
+ throw promise;
547
564
  }
548
565
  // Suspend if an active operation bears on this fragment, either the
549
566
  // fragment's owner or some other mutation etc. that could affect it.