react-relay 13.0.3 → 13.2.0

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.
Files changed (42) hide show
  1. package/ReactRelayContext.js +1 -1
  2. package/ReactRelayLocalQueryRenderer.js.flow +1 -1
  3. package/ReactRelayQueryRenderer.js.flow +1 -4
  4. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +1 -3
  5. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +1 -3
  6. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +2 -4
  7. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +1 -3
  8. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +2 -4
  9. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +1 -3
  10. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +1 -3
  11. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +1 -3
  12. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +1 -3
  13. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +1 -3
  14. package/hooks.js +1 -1
  15. package/index.js +1 -1
  16. package/jest-react/internalAct.js.flow +25 -9
  17. package/legacy.js +1 -1
  18. package/lib/ReactRelayQueryRenderer.js +1 -1
  19. package/lib/jest-react/internalAct.js +24 -4
  20. package/lib/relay-hooks/FragmentResource.js +10 -13
  21. package/lib/relay-hooks/QueryResource.js +2 -165
  22. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +7 -11
  23. package/lib/relay-hooks/react-cache/RelayReactCache.js +37 -0
  24. package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +197 -0
  25. package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +395 -0
  26. package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +45 -0
  27. package/package.json +3 -3
  28. package/react-relay-hooks.js +2 -2
  29. package/react-relay-hooks.min.js +2 -2
  30. package/react-relay-legacy.js +2 -2
  31. package/react-relay-legacy.min.js +2 -2
  32. package/react-relay.js +2 -2
  33. package/react-relay.min.js +2 -2
  34. package/relay-hooks/FragmentResource.js.flow +17 -18
  35. package/relay-hooks/QueryResource.js.flow +4 -201
  36. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +1 -3
  37. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +1 -3
  38. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +7 -14
  39. package/relay-hooks/react-cache/RelayReactCache.js.flow +42 -0
  40. package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +243 -0
  41. package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +416 -0
  42. package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +66 -0
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v13.0.3
2
+ * Relay v13.2.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -40,7 +40,7 @@ const queryRendererContext: ReactRelayQueryRendererContextType = {
40
40
  rootIsQueryRenderer: true,
41
41
  };
42
42
 
43
- function useDeepCompare<T: interface {}>(value: T): T {
43
+ function useDeepCompare<T: {...}>(value: T): T {
44
44
  const latestValue = React.useRef(value);
45
45
  if (!areEqual(latestValue.current, value)) {
46
46
  if (__DEV__) {
@@ -157,10 +157,7 @@ class ReactRelayQueryRenderer extends React.Component<Props, State> {
157
157
  }
158
158
 
159
159
  componentDidMount() {
160
- if (
161
- RelayFeatureFlags.ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT === true &&
162
- this._maybeHiddenOrFastRefresh === true
163
- ) {
160
+ if (this._maybeHiddenOrFastRefresh === true) {
164
161
  // This block only runs if the component has previously "unmounted"
165
162
  // due to it being hidden by the Offscreen API, or during fast refresh.
166
163
  // At this point, the current cached resource will have been disposed
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<6668406e80ad7dc93e7c813889280f83>>
7
+ * @generated SignedSource<<56e1daf6db87bf9886b3627a3e0d76f9>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -18,14 +18,12 @@
18
18
  import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  import type { FragmentType } from "relay-runtime";
20
20
  declare export opaque type ReactRelayFragmentContainerFlowtest_viewer$fragmentType: FragmentType;
21
- export type ReactRelayFragmentContainerFlowtest_viewer$ref = ReactRelayFragmentContainerFlowtest_viewer$fragmentType;
22
21
  export type ReactRelayFragmentContainerFlowtest_viewer$data = {|
23
22
  +actor: ?{|
24
23
  +id: string,
25
24
  |},
26
25
  +$fragmentType: ReactRelayFragmentContainerFlowtest_viewer$fragmentType,
27
26
  |};
28
- export type ReactRelayFragmentContainerFlowtest_viewer = ReactRelayFragmentContainerFlowtest_viewer$data;
29
27
  export type ReactRelayFragmentContainerFlowtest_viewer$key = {
30
28
  +$data?: ReactRelayFragmentContainerFlowtest_viewer$data,
31
29
  +$fragmentSpreads: ReactRelayFragmentContainerFlowtest_viewer$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<480a62dc560b619c9f4e6cf75d80f890>>
7
+ * @generated SignedSource<<c4fb5411e941bc7c5102499b684cf810>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -18,14 +18,12 @@
18
18
  import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  import type { FragmentType } from "relay-runtime";
20
20
  declare export opaque type ReactRelayFragmentContainerFlowtest_viewer2$fragmentType: FragmentType;
21
- export type ReactRelayFragmentContainerFlowtest_viewer2$ref = ReactRelayFragmentContainerFlowtest_viewer2$fragmentType;
22
21
  export type ReactRelayFragmentContainerFlowtest_viewer2$data = {|
23
22
  +actor: ?{|
24
23
  +id: string,
25
24
  |},
26
25
  +$fragmentType: ReactRelayFragmentContainerFlowtest_viewer2$fragmentType,
27
26
  |};
28
- export type ReactRelayFragmentContainerFlowtest_viewer2 = ReactRelayFragmentContainerFlowtest_viewer2$data;
29
27
  export type ReactRelayFragmentContainerFlowtest_viewer2$key = {
30
28
  +$data?: ReactRelayFragmentContainerFlowtest_viewer2$data,
31
29
  +$fragmentSpreads: ReactRelayFragmentContainerFlowtest_viewer2$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<b7185da5f330a37a0add055f5262b2bb>>
7
+ * @generated SignedSource<<059d6a6d94da6f9b3cf43a0418ecc7b8>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -21,15 +21,13 @@ export type ReactRelayPaginationContainerFlowtestQuery$variables = {|
21
21
  count: number,
22
22
  cursor?: ?string,
23
23
  |};
24
- export type ReactRelayPaginationContainerFlowtestQueryVariables = ReactRelayPaginationContainerFlowtestQuery$variables;
25
24
  export type ReactRelayPaginationContainerFlowtestQuery$data = {|
26
25
  +viewer: ?{|
27
26
  +$fragmentSpreads: ReactRelayPaginationContainerFlowtest_viewer$fragmentType,
28
27
  |},
29
28
  |};
30
- export type ReactRelayPaginationContainerFlowtestQueryResponse = ReactRelayPaginationContainerFlowtestQuery$data;
31
29
  export type ReactRelayPaginationContainerFlowtestQuery = {|
32
- variables: ReactRelayPaginationContainerFlowtestQueryVariables,
30
+ variables: ReactRelayPaginationContainerFlowtestQuery$variables,
33
31
  response: ReactRelayPaginationContainerFlowtestQuery$data,
34
32
  |};
35
33
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<0c271737f13fd548bcf58e0e3ec9d4ad>>
7
+ * @generated SignedSource<<86f990ee88078c49934d0f28c6c31da4>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -18,7 +18,6 @@
18
18
  import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  import type { FragmentType } from "relay-runtime";
20
20
  declare export opaque type ReactRelayPaginationContainerFlowtest_viewer$fragmentType: FragmentType;
21
- export type ReactRelayPaginationContainerFlowtest_viewer$ref = ReactRelayPaginationContainerFlowtest_viewer$fragmentType;
22
21
  export type ReactRelayPaginationContainerFlowtest_viewer$data = {|
23
22
  +account_user: ?{|
24
23
  +friends: ?{|
@@ -31,7 +30,6 @@ export type ReactRelayPaginationContainerFlowtest_viewer$data = {|
31
30
  |},
32
31
  +$fragmentType: ReactRelayPaginationContainerFlowtest_viewer$fragmentType,
33
32
  |};
34
- export type ReactRelayPaginationContainerFlowtest_viewer = ReactRelayPaginationContainerFlowtest_viewer$data;
35
33
  export type ReactRelayPaginationContainerFlowtest_viewer$key = {
36
34
  +$data?: ReactRelayPaginationContainerFlowtest_viewer$data,
37
35
  +$fragmentSpreads: ReactRelayPaginationContainerFlowtest_viewer$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<4966fff79753003b0e22a540764f020d>>
7
+ * @generated SignedSource<<a07bf128347274d353ab379de5eaef1f>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -21,15 +21,13 @@ export type ReactRelayRefetchContainerFlowtestQuery$variables = {|
21
21
  count: number,
22
22
  cursor?: ?string,
23
23
  |};
24
- export type ReactRelayRefetchContainerFlowtestQueryVariables = ReactRelayRefetchContainerFlowtestQuery$variables;
25
24
  export type ReactRelayRefetchContainerFlowtestQuery$data = {|
26
25
  +viewer: ?{|
27
26
  +$fragmentSpreads: ReactRelayRefetchContainerFlowtest_viewer$fragmentType,
28
27
  |},
29
28
  |};
30
- export type ReactRelayRefetchContainerFlowtestQueryResponse = ReactRelayRefetchContainerFlowtestQuery$data;
31
29
  export type ReactRelayRefetchContainerFlowtestQuery = {|
32
- variables: ReactRelayRefetchContainerFlowtestQueryVariables,
30
+ variables: ReactRelayRefetchContainerFlowtestQuery$variables,
33
31
  response: ReactRelayRefetchContainerFlowtestQuery$data,
34
32
  |};
35
33
  */
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<8a7c1dee99527959e2031640c3ee39e7>>
7
+ * @generated SignedSource<<6d9922010e1474b1214c383c394daa24>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -18,7 +18,6 @@
18
18
  import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  import type { FragmentType } from "relay-runtime";
20
20
  declare export opaque type ReactRelayRefetchContainerFlowtest_viewer$fragmentType: FragmentType;
21
- export type ReactRelayRefetchContainerFlowtest_viewer$ref = ReactRelayRefetchContainerFlowtest_viewer$fragmentType;
22
21
  export type ReactRelayRefetchContainerFlowtest_viewer$data = {|
23
22
  +account_user: ?{|
24
23
  +friends: ?{|
@@ -31,7 +30,6 @@ export type ReactRelayRefetchContainerFlowtest_viewer$data = {|
31
30
  |},
32
31
  +$fragmentType: ReactRelayRefetchContainerFlowtest_viewer$fragmentType,
33
32
  |};
34
- export type ReactRelayRefetchContainerFlowtest_viewer = ReactRelayRefetchContainerFlowtest_viewer$data;
35
33
  export type ReactRelayRefetchContainerFlowtest_viewer$key = {
36
34
  +$data?: ReactRelayRefetchContainerFlowtest_viewer$data,
37
35
  +$fragmentSpreads: ReactRelayRefetchContainerFlowtest_viewer$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<da21127f700568aaf02b9cfa2a6d86f8>>
7
+ * @generated SignedSource<<050146f21476e7ed6edd2243d4c6b65d>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -19,13 +19,11 @@ import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  type RelayModernFlowtest_user$fragmentType = any;
20
20
  import type { FragmentType } from "relay-runtime";
21
21
  declare export opaque type RelayModernFlowtest_badref$fragmentType: FragmentType;
22
- export type RelayModernFlowtest_badref$ref = RelayModernFlowtest_badref$fragmentType;
23
22
  export type RelayModernFlowtest_badref$data = {|
24
23
  +id: string,
25
24
  +$fragmentSpreads: RelayModernFlowtest_user$fragmentType,
26
25
  +$fragmentType: RelayModernFlowtest_badref$fragmentType,
27
26
  |};
28
- export type RelayModernFlowtest_badref = RelayModernFlowtest_badref$data;
29
27
  export type RelayModernFlowtest_badref$key = {
30
28
  +$data?: RelayModernFlowtest_badref$data,
31
29
  +$fragmentSpreads: RelayModernFlowtest_badref$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<5af505c845bc81cfc4ab5316649a2329>>
7
+ * @generated SignedSource<<d8eae7df6faa43d95f6140dc3c9ad3ba>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -19,13 +19,11 @@ import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  type RelayModernFlowtest_user$fragmentType = any;
20
20
  import type { FragmentType } from "relay-runtime";
21
21
  declare export opaque type RelayModernFlowtest_notref$fragmentType: FragmentType;
22
- export type RelayModernFlowtest_notref$ref = RelayModernFlowtest_notref$fragmentType;
23
22
  export type RelayModernFlowtest_notref$data = {|
24
23
  +id: string,
25
24
  +$fragmentSpreads: RelayModernFlowtest_user$fragmentType,
26
25
  +$fragmentType: RelayModernFlowtest_notref$fragmentType,
27
26
  |};
28
- export type RelayModernFlowtest_notref = RelayModernFlowtest_notref$data;
29
27
  export type RelayModernFlowtest_notref$key = {
30
28
  +$data?: RelayModernFlowtest_notref$data,
31
29
  +$fragmentSpreads: RelayModernFlowtest_notref$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<59c4945eff10b906fbac41d74da830e3>>
7
+ * @generated SignedSource<<a7ba31d9d2381b0c8b700175be271b75>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -18,12 +18,10 @@
18
18
  import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  import type { FragmentType } from "relay-runtime";
20
20
  declare export opaque type RelayModernFlowtest_user$fragmentType: FragmentType;
21
- export type RelayModernFlowtest_user$ref = RelayModernFlowtest_user$fragmentType;
22
21
  export type RelayModernFlowtest_user$data = {|
23
22
  +name: ?string,
24
23
  +$fragmentType: RelayModernFlowtest_user$fragmentType,
25
24
  |};
26
- export type RelayModernFlowtest_user = RelayModernFlowtest_user$data;
27
25
  export type RelayModernFlowtest_user$key = {
28
26
  +$data?: RelayModernFlowtest_user$data,
29
27
  +$fragmentSpreads: RelayModernFlowtest_user$fragmentType,
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<0f29cb3f58c5e6863095be5bb78fa2ba>>
7
+ * @generated SignedSource<<d032f6e721c9c9cdd034cdd93dfcbad6>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -18,12 +18,10 @@
18
18
  import type { Fragment, ReaderFragment } from 'relay-runtime';
19
19
  import type { FragmentType } from "relay-runtime";
20
20
  declare export opaque type RelayModernFlowtest_users$fragmentType: FragmentType;
21
- export type RelayModernFlowtest_users$ref = RelayModernFlowtest_users$fragmentType;
22
21
  export type RelayModernFlowtest_users$data = $ReadOnlyArray<{|
23
22
  +name: ?string,
24
23
  +$fragmentType: RelayModernFlowtest_users$fragmentType,
25
24
  |}>;
26
- export type RelayModernFlowtest_users = RelayModernFlowtest_users$data;
27
25
  export type RelayModernFlowtest_users$key = $ReadOnlyArray<{
28
26
  +$data?: RelayModernFlowtest_users$data,
29
27
  +$fragmentSpreads: RelayModernFlowtest_users$fragmentType,
package/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v13.0.3
2
+ * Relay v13.2.0
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 v13.0.3
2
+ * Relay v13.2.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -36,7 +36,7 @@ interface Thenable<+R> {
36
36
 
37
37
  let actingUpdatesScopeDepth = 0;
38
38
 
39
- function act(scope: () => Thenable<mixed> | void) {
39
+ function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
40
40
  if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
41
41
  throw Error(
42
42
  'This version of `act` requires a special mock build of Scheduler.',
@@ -49,10 +49,19 @@ function act(scope: () => Thenable<mixed> | void) {
49
49
  );
50
50
  }
51
51
 
52
+ const previousIsActEnvironment = global.IS_REACT_ACT_ENVIRONMENT;
52
53
  const previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
53
54
  actingUpdatesScopeDepth++;
55
+ if (__DEV__ && actingUpdatesScopeDepth === 1) {
56
+ // Because this is not the "real" `act`, we set this to `false` so React
57
+ // knows not to fire `act` warnings.
58
+ global.IS_REACT_ACT_ENVIRONMENT = false;
59
+ }
54
60
 
55
61
  const unwind = () => {
62
+ if (__DEV__ && actingUpdatesScopeDepth === 1) {
63
+ global.IS_REACT_ACT_ENVIRONMENT = previousIsActEnvironment;
64
+ }
56
65
  actingUpdatesScopeDepth--;
57
66
 
58
67
  if (__DEV__) {
@@ -71,20 +80,21 @@ function act(scope: () => Thenable<mixed> | void) {
71
80
  // returned and 2) we could use async/await. Since it's only our used in
72
81
  // our test suite, we should be able to.
73
82
  try {
74
- const thenable = scope();
83
+ const result = scope();
75
84
  if (
76
- typeof thenable === 'object' &&
77
- thenable !== null &&
78
- typeof thenable.then === 'function'
85
+ typeof result === 'object' &&
86
+ result !== null &&
87
+ typeof result.then === 'function'
79
88
  ) {
89
+ const thenableResult: Thenable<T> = (result: any);
80
90
  return {
81
- then(resolve: () => void, reject: (error: mixed) => void) {
82
- thenable.then(
83
- () => {
91
+ then(resolve, reject) {
92
+ thenableResult.then(
93
+ returnValue => {
84
94
  flushActWork(
85
95
  () => {
86
96
  unwind();
87
- resolve();
97
+ resolve(returnValue);
88
98
  },
89
99
  error => {
90
100
  unwind();
@@ -100,6 +110,7 @@ function act(scope: () => Thenable<mixed> | void) {
100
110
  },
101
111
  };
102
112
  } else {
113
+ const returnValue: T = (result: any);
103
114
  try {
104
115
  // TODO: Let's not support non-async scopes at all in our tests. Need to
105
116
  // migrate existing tests.
@@ -107,6 +118,11 @@ function act(scope: () => Thenable<mixed> | void) {
107
118
  do {
108
119
  didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
109
120
  } while (didFlushWork);
121
+ return {
122
+ then(resolve, reject) {
123
+ resolve(returnValue);
124
+ },
125
+ };
110
126
  } finally {
111
127
  unwind();
112
128
  }
package/legacy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v13.0.3
2
+ * Relay v13.2.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -132,7 +132,7 @@ var ReactRelayQueryRenderer = /*#__PURE__*/function (_React$Component) {
132
132
  _proto.componentDidMount = function componentDidMount() {
133
133
  var _this2 = this;
134
134
 
135
- if (RelayFeatureFlags.ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT === true && this._maybeHiddenOrFastRefresh === true) {
135
+ if (this._maybeHiddenOrFastRefresh === true) {
136
136
  // This block only runs if the component has previously "unmounted"
137
137
  // due to it being hidden by the Offscreen API, or during fast refresh.
138
138
  // At this point, the current cached resource will have been disposed
@@ -36,10 +36,21 @@ function act(scope) {
36
36
  throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
37
37
  }
38
38
 
39
+ var previousIsActEnvironment = global.IS_REACT_ACT_ENVIRONMENT;
39
40
  var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
40
41
  actingUpdatesScopeDepth++;
41
42
 
43
+ if (process.env.NODE_ENV !== "production" && actingUpdatesScopeDepth === 1) {
44
+ // Because this is not the "real" `act`, we set this to `false` so React
45
+ // knows not to fire `act` warnings.
46
+ global.IS_REACT_ACT_ENVIRONMENT = false;
47
+ }
48
+
42
49
  var unwind = function unwind() {
50
+ if (process.env.NODE_ENV !== "production" && actingUpdatesScopeDepth === 1) {
51
+ global.IS_REACT_ACT_ENVIRONMENT = previousIsActEnvironment;
52
+ }
53
+
43
54
  actingUpdatesScopeDepth--;
44
55
 
45
56
  if (process.env.NODE_ENV !== "production") {
@@ -55,15 +66,16 @@ function act(scope) {
55
66
 
56
67
 
57
68
  try {
58
- var thenable = scope();
69
+ var result = scope();
59
70
 
60
- if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') {
71
+ if (typeof result === 'object' && result !== null && typeof result.then === 'function') {
72
+ var thenableResult = result;
61
73
  return {
62
74
  then: function then(resolve, reject) {
63
- thenable.then(function () {
75
+ thenableResult.then(function (returnValue) {
64
76
  flushActWork(function () {
65
77
  unwind();
66
- resolve();
78
+ resolve(returnValue);
67
79
  }, function (error) {
68
80
  unwind();
69
81
  reject(error);
@@ -75,6 +87,8 @@ function act(scope) {
75
87
  }
76
88
  };
77
89
  } else {
90
+ var returnValue = result;
91
+
78
92
  try {
79
93
  // TODO: Let's not support non-async scopes at all in our tests. Need to
80
94
  // migrate existing tests.
@@ -83,6 +97,12 @@ function act(scope) {
83
97
  do {
84
98
  didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
85
99
  } while (didFlushWork);
100
+
101
+ return {
102
+ then: function then(resolve, reject) {
103
+ resolve(returnValue);
104
+ }
105
+ };
86
106
  } finally {
87
107
  unwind();
88
108
  }
@@ -38,9 +38,9 @@ var _require2 = require('relay-runtime'),
38
38
  getPendingOperationsForFragment = _require2.getPendingOperationsForFragment,
39
39
  getSelector = _require2.getSelector,
40
40
  getVariablesFromFragment = _require2.getVariablesFromFragment,
41
+ handlePotentialSnapshotErrors = _require2.handlePotentialSnapshotErrors,
41
42
  isPromise = _require2.isPromise,
42
- recycleNodesInto = _require2.recycleNodesInto,
43
- reportMissingRequiredFields = _require2.reportMissingRequiredFields;
43
+ recycleNodesInto = _require2.recycleNodesInto;
44
44
 
45
45
  var WEAKMAP_SUPPORTED = typeof WeakMap === 'function';
46
46
  // TODO: Fix to not rely on LRU. If the number of active fragments exceeds this
@@ -263,7 +263,7 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
263
263
  }
264
264
 
265
265
  if (cachedValue.kind === 'done' && cachedValue.result.snapshot) {
266
- this._reportMissingRequiredFieldsInSnapshot(cachedValue.result.snapshot);
266
+ this._handlePotentialSnapshotErrorsInSnapshot(cachedValue.result.snapshot);
267
267
 
268
268
  return cachedValue.result;
269
269
  }
@@ -279,7 +279,7 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
279
279
  var fragmentResult = getFragmentResult(fragmentIdentifier, snapshot, storeEpoch);
280
280
 
281
281
  if (!fragmentResult.isMissingData) {
282
- this._reportMissingRequiredFieldsInSnapshot(snapshot);
282
+ this._handlePotentialSnapshotErrorsInSnapshot(snapshot);
283
283
 
284
284
  this._cache.set(fragmentIdentifier, {
285
285
  kind: 'done',
@@ -361,7 +361,7 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
361
361
  throw ((_clientEdgePromises2 = clientEdgePromises) === null || _clientEdgePromises2 === void 0 ? void 0 : _clientEdgePromises2.length) ? Promise.all([parentQueryPromiseResultPromise].concat((0, _toConsumableArray2["default"])(clientEdgePromises))) : parentQueryPromiseResultPromise;
362
362
  }
363
363
 
364
- this._reportMissingRequiredFieldsInSnapshot(snapshot);
364
+ this._handlePotentialSnapshotErrorsInSnapshot(snapshot);
365
365
 
366
366
  return getFragmentResult(fragmentIdentifier, snapshot, storeEpoch);
367
367
  };
@@ -383,19 +383,15 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
383
383
  };
384
384
  };
385
385
 
386
- _proto2._reportMissingRequiredFieldsInSnapshot = function _reportMissingRequiredFieldsInSnapshot(snapshot) {
386
+ _proto2._handlePotentialSnapshotErrorsInSnapshot = function _handlePotentialSnapshotErrorsInSnapshot(snapshot) {
387
387
  var _this4 = this;
388
388
 
389
389
  if (Array.isArray(snapshot)) {
390
390
  snapshot.forEach(function (s) {
391
- if (s.missingRequiredFields != null) {
392
- reportMissingRequiredFields(_this4._environment, s.missingRequiredFields);
393
- }
391
+ handlePotentialSnapshotErrors(_this4._environment, s.missingRequiredFields, s.relayResolverErrors);
394
392
  });
395
393
  } else {
396
- if (snapshot.missingRequiredFields != null) {
397
- reportMissingRequiredFields(this._environment, snapshot.missingRequiredFields);
398
- }
394
+ handlePotentialSnapshotErrors(this._environment, snapshot.missingRequiredFields, snapshot.relayResolverErrors);
399
395
  }
400
396
  };
401
397
 
@@ -559,7 +555,8 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
559
555
  missingClientEdges: currentSnapshot.missingClientEdges,
560
556
  seenRecords: currentSnapshot.seenRecords,
561
557
  selector: currentSnapshot.selector,
562
- missingRequiredFields: currentSnapshot.missingRequiredFields
558
+ missingRequiredFields: currentSnapshot.missingRequiredFields,
559
+ relayResolverErrors: currentSnapshot.relayResolverErrors
563
560
  };
564
561
 
565
562
  if (updatedData !== renderData) {