react-relay 13.1.1 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. package/ReactRelayContainerUtils.js.flow +0 -2
  2. package/ReactRelayContext.js +1 -1
  3. package/ReactRelayContext.js.flow +0 -2
  4. package/ReactRelayFragmentContainer.js.flow +7 -6
  5. package/ReactRelayFragmentMockRenderer.js.flow +0 -2
  6. package/ReactRelayLocalQueryRenderer.js.flow +1 -3
  7. package/ReactRelayPaginationContainer.js.flow +13 -10
  8. package/ReactRelayQueryFetcher.js.flow +10 -11
  9. package/ReactRelayQueryRenderer.js.flow +15 -16
  10. package/ReactRelayQueryRendererContext.js.flow +1 -3
  11. package/ReactRelayRefetchContainer.js.flow +10 -7
  12. package/ReactRelayTestMocker.js.flow +0 -2
  13. package/ReactRelayTypes.js.flow +6 -8
  14. package/RelayContext.js.flow +0 -2
  15. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -4
  16. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +3 -5
  17. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +3 -5
  18. package/__flowtests__/RelayModern-flowtest.js.flow +2 -4
  19. package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +2 -4
  20. package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +2 -4
  21. package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +2 -4
  22. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +2 -4
  23. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +2 -2
  24. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +2 -2
  25. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +3 -3
  26. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +3 -3
  27. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +3 -3
  28. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +3 -3
  29. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +2 -2
  30. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +2 -2
  31. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +2 -2
  32. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +2 -2
  33. package/assertFragmentMap.js.flow +0 -2
  34. package/buildReactRelayContainer.js.flow +2 -4
  35. package/getRootVariablesForFragments.js.flow +0 -2
  36. package/hooks.js +1 -1
  37. package/hooks.js.flow +0 -2
  38. package/index.js +1 -1
  39. package/index.js.flow +2 -2
  40. package/isRelayEnvironment.js.flow +0 -2
  41. package/jest-react/internalAct.js.flow +25 -9
  42. package/legacy.js +1 -1
  43. package/legacy.js.flow +0 -2
  44. package/lib/ReactRelayContainerUtils.js +0 -1
  45. package/lib/ReactRelayContext.js +0 -1
  46. package/lib/ReactRelayFragmentContainer.js +10 -9
  47. package/lib/ReactRelayFragmentMockRenderer.js +0 -1
  48. package/lib/ReactRelayLocalQueryRenderer.js +0 -1
  49. package/lib/ReactRelayPaginationContainer.js +14 -11
  50. package/lib/ReactRelayQueryFetcher.js +2 -2
  51. package/lib/ReactRelayQueryRenderer.js +2 -4
  52. package/lib/ReactRelayQueryRendererContext.js +0 -1
  53. package/lib/ReactRelayRefetchContainer.js +11 -14
  54. package/lib/ReactRelayTestMocker.js +1 -2
  55. package/lib/ReactRelayTypes.js +0 -1
  56. package/lib/RelayContext.js +0 -1
  57. package/lib/assertFragmentMap.js +0 -1
  58. package/lib/buildReactRelayContainer.js +1 -2
  59. package/lib/getRootVariablesForFragments.js +1 -2
  60. package/lib/hooks.js +0 -1
  61. package/lib/index.js +3 -1
  62. package/lib/isRelayEnvironment.js +0 -1
  63. package/lib/jest-react/internalAct.js +24 -4
  64. package/lib/legacy.js +0 -1
  65. package/lib/multi-actor/useRelayActorEnvironment.js +0 -1
  66. package/lib/readContext.js +2 -2
  67. package/lib/relay-hooks/EntryPointContainer.react.js +0 -1
  68. package/lib/relay-hooks/EntryPointTypes.flow.js +0 -1
  69. package/lib/relay-hooks/FragmentResource.js +68 -29
  70. package/lib/relay-hooks/HooksImplementation.js +29 -0
  71. package/lib/relay-hooks/InternalLogger.js +0 -1
  72. package/lib/relay-hooks/LRUCache.js +0 -1
  73. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +0 -1
  74. package/lib/relay-hooks/MatchContainer.js +2 -2
  75. package/lib/relay-hooks/ProfilerContext.js +0 -1
  76. package/lib/relay-hooks/QueryResource.js +5 -168
  77. package/lib/relay-hooks/RelayEnvironmentProvider.js +0 -1
  78. package/lib/relay-hooks/SuspenseResource.js +1 -2
  79. package/lib/relay-hooks/loadQuery.js +1 -1
  80. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +8 -13
  81. package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +0 -1
  82. package/lib/relay-hooks/react-cache/RelayReactCache.js +36 -0
  83. package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +344 -0
  84. package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +239 -0
  85. package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +598 -0
  86. package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +50 -0
  87. package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +55 -0
  88. package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +150 -0
  89. package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +124 -0
  90. package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +367 -0
  91. package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +45 -0
  92. package/lib/relay-hooks/useBlockingPaginationFragment.js +4 -3
  93. package/lib/relay-hooks/useClientQuery.js +33 -0
  94. package/lib/relay-hooks/useEntryPointLoader.js +1 -2
  95. package/lib/relay-hooks/useFetchTrackingRef.js +0 -1
  96. package/lib/relay-hooks/useFragment.js +15 -2
  97. package/lib/relay-hooks/useFragmentNode.js +0 -1
  98. package/lib/relay-hooks/useIsMountedRef.js +0 -1
  99. package/lib/relay-hooks/useLazyLoadQuery.js +4 -2
  100. package/lib/relay-hooks/useLazyLoadQueryNode.js +0 -1
  101. package/lib/relay-hooks/useLoadMoreFunction.js +1 -2
  102. package/lib/relay-hooks/useMemoOperationDescriptor.js +0 -1
  103. package/lib/relay-hooks/useMemoVariables.js +0 -1
  104. package/lib/relay-hooks/useMutation.js +5 -7
  105. package/lib/relay-hooks/usePaginationFragment.js +15 -3
  106. package/lib/relay-hooks/usePreloadedQuery.js +4 -2
  107. package/lib/relay-hooks/useQueryLoader.js +1 -2
  108. package/lib/relay-hooks/useRefetchableFragment.js +14 -2
  109. package/lib/relay-hooks/useRefetchableFragmentNode.js +1 -2
  110. package/lib/relay-hooks/useRelayEnvironment.js +0 -1
  111. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +0 -1
  112. package/lib/relay-hooks/useSubscribeToInvalidationState.js +0 -1
  113. package/lib/relay-hooks/useSubscription.js +0 -1
  114. package/multi-actor/useRelayActorEnvironment.js.flow +0 -2
  115. package/package.json +3 -3
  116. package/react-relay-hooks.js +2 -2
  117. package/react-relay-hooks.min.js +2 -2
  118. package/react-relay-legacy.js +2 -2
  119. package/react-relay-legacy.min.js +2 -2
  120. package/react-relay.js +2 -2
  121. package/react-relay.min.js +2 -2
  122. package/readContext.js.flow +1 -2
  123. package/relay-hooks/EntryPointContainer.react.js.flow +2 -4
  124. package/relay-hooks/EntryPointTypes.flow.js.flow +30 -32
  125. package/relay-hooks/FragmentResource.js.flow +80 -37
  126. package/relay-hooks/HooksImplementation.js.flow +43 -0
  127. package/relay-hooks/InternalLogger.js.flow +0 -2
  128. package/relay-hooks/LRUCache.js.flow +0 -2
  129. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +4 -6
  130. package/relay-hooks/MatchContainer.js.flow +11 -6
  131. package/relay-hooks/ProfilerContext.js.flow +0 -2
  132. package/relay-hooks/QueryResource.js.flow +12 -209
  133. package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -4
  134. package/relay-hooks/SuspenseResource.js.flow +0 -2
  135. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -3
  136. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +2 -2
  137. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +2 -2
  138. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +2 -2
  139. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +4 -6
  140. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +0 -2
  141. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +4 -6
  142. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +0 -2
  143. package/relay-hooks/__flowtests__/utils.js.flow +8 -10
  144. package/relay-hooks/loadQuery.js.flow +2 -1
  145. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +11 -20
  146. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +0 -2
  147. package/relay-hooks/react-cache/RelayReactCache.js.flow +40 -0
  148. package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +430 -0
  149. package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +297 -0
  150. package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +599 -0
  151. package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +72 -0
  152. package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +70 -0
  153. package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +171 -0
  154. package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +151 -0
  155. package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +595 -0
  156. package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +65 -0
  157. package/relay-hooks/useBlockingPaginationFragment.js.flow +4 -6
  158. package/relay-hooks/useClientQuery.js.flow +39 -0
  159. package/relay-hooks/useEntryPointLoader.js.flow +6 -8
  160. package/relay-hooks/useFetchTrackingRef.js.flow +2 -4
  161. package/relay-hooks/useFragment.js.flow +17 -12
  162. package/relay-hooks/useFragmentNode.js.flow +2 -4
  163. package/relay-hooks/useIsMountedRef.js.flow +1 -3
  164. package/relay-hooks/useLazyLoadQuery.js.flow +17 -5
  165. package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -4
  166. package/relay-hooks/useLoadMoreFunction.js.flow +6 -8
  167. package/relay-hooks/useMemoOperationDescriptor.js.flow +0 -2
  168. package/relay-hooks/useMemoVariables.js.flow +0 -2
  169. package/relay-hooks/useMutation.js.flow +5 -7
  170. package/relay-hooks/usePaginationFragment.js.flow +44 -19
  171. package/relay-hooks/usePreloadedQuery.js.flow +14 -5
  172. package/relay-hooks/useQueryLoader.js.flow +4 -6
  173. package/relay-hooks/useRefetchableFragment.js.flow +32 -3
  174. package/relay-hooks/useRefetchableFragmentNode.js.flow +38 -25
  175. package/relay-hooks/useRelayEnvironment.js.flow +0 -2
  176. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +0 -2
  177. package/relay-hooks/useSubscribeToInvalidationState.js.flow +0 -2
  178. package/relay-hooks/useSubscription.js.flow +14 -10
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<56e1daf6db87bf9886b3627a3e0d76f9>>
7
+ * @generated SignedSource<<23bcef30afc22a42d79dd52e0cfe899c>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<c4fb5411e941bc7c5102499b684cf810>>
7
+ * @generated SignedSource<<af6c4570779066ea564051c9c71c494f>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<059d6a6d94da6f9b3cf43a0418ecc7b8>>
7
+ * @generated SignedSource<<6d173a357c286b417fdc586a839384d4>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -27,8 +27,8 @@ export type ReactRelayPaginationContainerFlowtestQuery$data = {|
27
27
  |},
28
28
  |};
29
29
  export type ReactRelayPaginationContainerFlowtestQuery = {|
30
- variables: ReactRelayPaginationContainerFlowtestQuery$variables,
31
30
  response: ReactRelayPaginationContainerFlowtestQuery$data,
31
+ variables: ReactRelayPaginationContainerFlowtestQuery$variables,
32
32
  |};
33
33
  */
34
34
 
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<86f990ee88078c49934d0f28c6c31da4>>
7
+ * @generated SignedSource<<b3cddee250d0ff22e89a7f0331e85df6>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -23,7 +23,7 @@ export type ReactRelayPaginationContainerFlowtest_viewer$data = {|
23
23
  +friends: ?{|
24
24
  +edges: ?$ReadOnlyArray<?{|
25
25
  +node: ?{|
26
- +__typename: string,
26
+ +__typename: "User",
27
27
  |},
28
28
  |}>,
29
29
  |},
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<a07bf128347274d353ab379de5eaef1f>>
7
+ * @generated SignedSource<<3b1b16b5d5ec1c94783d6161ae61bc3d>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -27,8 +27,8 @@ export type ReactRelayRefetchContainerFlowtestQuery$data = {|
27
27
  |},
28
28
  |};
29
29
  export type ReactRelayRefetchContainerFlowtestQuery = {|
30
- variables: ReactRelayRefetchContainerFlowtestQuery$variables,
31
30
  response: ReactRelayRefetchContainerFlowtestQuery$data,
31
+ variables: ReactRelayRefetchContainerFlowtestQuery$variables,
32
32
  |};
33
33
  */
34
34
 
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<6d9922010e1474b1214c383c394daa24>>
7
+ * @generated SignedSource<<6d04d7f7bf097d5869a1fdf0dea1e659>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -23,7 +23,7 @@ export type ReactRelayRefetchContainerFlowtest_viewer$data = {|
23
23
  +friends: ?{|
24
24
  +edges: ?$ReadOnlyArray<?{|
25
25
  +node: ?{|
26
- +__typename: string,
26
+ +__typename: "User",
27
27
  |},
28
28
  |}>,
29
29
  |},
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<050146f21476e7ed6edd2243d4c6b65d>>
7
+ * @generated SignedSource<<d3c71cb965d8374d40fb30f3c5ae9fd4>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<d8eae7df6faa43d95f6140dc3c9ad3ba>>
7
+ * @generated SignedSource<<bd60df80c19d8248426865abbc23562e>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<a7ba31d9d2381b0c8b700175be271b75>>
7
+ * @generated SignedSource<<527809017626cb43378afb92fed67feb>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
3
+ *
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<<d032f6e721c9c9cdd034cdd93dfcbad6>>
7
+ * @generated SignedSource<<8a94ce305c03af7280da9b95a665349f>>
8
8
  * @flow
9
9
  * @lightSyntaxTransform
10
10
  * @nogrep
@@ -8,8 +8,6 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
12
 
15
13
  import type {GeneratedNodeMap} from './ReactRelayTypes';
@@ -8,10 +8,8 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
-
12
+ import type {ReaderFragment} from '../relay-runtime/util/ReaderNode';
15
13
  import type {GeneratedNodeMap} from './ReactRelayTypes';
16
14
  import type {FragmentMap} from 'relay-runtime';
17
15
 
@@ -45,7 +43,7 @@ function buildReactRelayContainer<TBase: React$ComponentType<any>>(
45
43
  const containerName = getContainerName(ComponentClass);
46
44
  assertFragmentMap(getComponentName(ComponentClass), fragmentSpec);
47
45
 
48
- const fragments = {};
46
+ const fragments: {[string]: ReaderFragment} = {};
49
47
  for (const key in fragmentSpec) {
50
48
  fragments[key] = getFragment(fragmentSpec[key]);
51
49
  }
@@ -8,8 +8,6 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
12
 
15
13
  import type {FragmentMap, Variables} from 'relay-runtime';
package/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v13.1.1
2
+ * Relay v14.1.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/hooks.js.flow CHANGED
@@ -8,8 +8,6 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
12
 
15
13
  const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v13.1.1
2
+ * Relay v14.1.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/index.js.flow CHANGED
@@ -8,8 +8,6 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
12
 
15
13
  const ReactRelayContext = require('./ReactRelayContext');
@@ -22,6 +20,7 @@ const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
22
20
  const loadEntryPoint = require('./relay-hooks/loadEntryPoint');
23
21
  const {loadQuery} = require('./relay-hooks/loadQuery');
24
22
  const RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
23
+ const useClientQuery = require('./relay-hooks/useClientQuery');
25
24
  const useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
26
25
  const useFragment = require('./relay-hooks/useFragment');
27
26
  const useLazyLoadQuery = require('./relay-hooks/useLazyLoadQuery');
@@ -113,6 +112,7 @@ module.exports = {
113
112
  loadQuery: loadQuery,
114
113
  loadEntryPoint: loadEntryPoint,
115
114
 
115
+ useClientQuery: useClientQuery,
116
116
  useFragment: useFragment,
117
117
  useLazyLoadQuery: useLazyLoadQuery,
118
118
  useEntryPointLoader: useEntryPointLoader,
@@ -8,8 +8,6 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
12
 
15
13
  /**
@@ -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.1.1
2
+ * Relay v14.1.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/legacy.js.flow CHANGED
@@ -8,8 +8,6 @@
8
8
  * @format
9
9
  */
10
10
 
11
- // flowlint ambiguous-object-type:error
12
-
13
11
  'use strict';
14
12
 
15
13
  const ReactRelayContext = require('./ReactRelayContext');
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  function getComponentName(component) {
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var React = require('react');
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
15
 
@@ -22,6 +21,8 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
22
21
 
23
22
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
24
23
 
24
+ var _excluded = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
25
+
25
26
  var buildReactRelayContainer = require('./buildReactRelayContainer');
26
27
 
27
28
  var _require = require('./ReactRelayContainerUtils'),
@@ -45,10 +46,10 @@ var _require3 = require('relay-runtime'),
45
46
  * updates.
46
47
  */
47
48
  function createContainerWithFragments(Component, fragments) {
48
- var _class, _temp;
49
+ var _class;
49
50
 
50
51
  var containerName = getContainerName(Component);
51
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
52
+ return _class = /*#__PURE__*/function (_React$Component) {
52
53
  (0, _inheritsLoose2["default"])(_class, _React$Component);
53
54
 
54
55
  function _class(props) {
@@ -168,14 +169,14 @@ function createContainerWithFragments(Component, fragments) {
168
169
  var keys = Object.keys(nextProps);
169
170
 
170
171
  for (var ii = 0; ii < keys.length; ii++) {
171
- var _key = keys[ii];
172
+ var key = keys[ii];
172
173
 
173
- if (_key === '__relayContext') {
174
+ if (key === '__relayContext') {
174
175
  if (nextState.prevPropsContext.environment !== this.state.prevPropsContext.environment) {
175
176
  return true;
176
177
  }
177
178
  } else {
178
- if (!fragments.hasOwnProperty(_key) && !isScalarAndEqual(nextProps[_key], this.props[_key])) {
179
+ if (!fragments.hasOwnProperty(key) && !isScalarAndEqual(nextProps[key], this.props[key])) {
179
180
  return true;
180
181
  }
181
182
  }
@@ -225,7 +226,7 @@ function createContainerWithFragments(Component, fragments) {
225
226
  componentRef = _this$props.componentRef,
226
227
  __relayContext = _this$props.__relayContext,
227
228
  __rootIsQueryRenderer = _this$props.__rootIsQueryRenderer,
228
- props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
229
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
229
230
  return React.createElement(Component, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), this.state.data), {}, {
230
231
  ref: componentRef,
231
232
  relay: this.state.relayProp
@@ -233,7 +234,7 @@ function createContainerWithFragments(Component, fragments) {
233
234
  };
234
235
 
235
236
  return _class;
236
- }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _temp;
237
+ }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
237
238
  }
238
239
 
239
240
  function getRelayProp(environment) {
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var ReactRelayContext = require('./ReactRelayContext');
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var ReactRelayContext = require('./ReactRelayContext');
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
15
 
@@ -24,6 +23,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
24
23
 
25
24
  var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
26
25
 
26
+ var _excluded = ["componentRef"],
27
+ _excluded2 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"],
28
+ _excluded3 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
29
+
27
30
  var buildReactRelayContainer = require('./buildReactRelayContainer');
28
31
 
29
32
  var getRootVariablesForFragments = require('./getRootVariablesForFragments');
@@ -255,7 +258,7 @@ function toObserver(observerOrCallback) {
255
258
  }
256
259
 
257
260
  function createContainerWithFragments(Component, fragments, connectionConfig) {
258
- var _class, _temp;
261
+ var _class;
259
262
 
260
263
  var componentName = getComponentName(Component);
261
264
  var containerName = getContainerName(Component);
@@ -264,7 +267,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
264
267
  var direction = connectionConfig.direction || metadata.direction;
265
268
  !direction ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Unable to infer direction of the ' + 'connection, possibly because both first and last are provided.') : invariant(false) : void 0;
266
269
  var getFragmentVariables = connectionConfig.getFragmentVariables || createGetFragmentVariables(metadata);
267
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
270
+ return _class = /*#__PURE__*/function (_React$Component) {
268
271
  (0, _inheritsLoose2["default"])(_class, _React$Component);
269
272
 
270
273
  function _class(props) {
@@ -462,14 +465,14 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
462
465
  var keys = Object.keys(nextProps);
463
466
 
464
467
  for (var ii = 0; ii < keys.length; ii++) {
465
- var _key = keys[ii];
468
+ var key = keys[ii];
466
469
 
467
- if (_key === '__relayContext') {
470
+ if (key === '__relayContext') {
468
471
  if (nextState.prevContext.environment !== this.state.prevContext.environment) {
469
472
  return true;
470
473
  }
471
474
  } else {
472
- if (!fragments.hasOwnProperty(_key) && !isScalarAndEqual(nextProps[_key], this.props[_key])) {
475
+ if (!fragments.hasOwnProperty(key) && !isScalarAndEqual(nextProps[key], this.props[key])) {
473
476
  return true;
474
477
  }
475
478
  }
@@ -527,7 +530,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
527
530
  // Extract connection data and verify there are more edges to fetch
528
531
  var _this$props = this.props,
529
532
  _ = _this$props.componentRef,
530
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, ["componentRef"]);
533
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
531
534
  var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
532
535
  var connectionData = getConnectionFromProps(props);
533
536
 
@@ -595,7 +598,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
595
598
  _ = _this$props2.componentRef,
596
599
  __relayContext = _this$props2.__relayContext,
597
600
  __rootIsQueryRenderer = _this$props2.__rootIsQueryRenderer,
598
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
601
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, _excluded2);
599
602
  var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
600
603
  var fragmentVariables;
601
604
  var rootVariables = getRootVariablesForFragments(fragments, restProps);
@@ -707,7 +710,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
707
710
  componentRef = _this$props3.componentRef,
708
711
  __relayContext = _this$props3.__relayContext,
709
712
  __rootIsQueryRenderer = _this$props3.__rootIsQueryRenderer,
710
- props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props3, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
713
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props3, _excluded3);
711
714
  return /*#__PURE__*/React.createElement(ReactRelayContext.Provider, {
712
715
  value: this.state.contextForChildren
713
716
  }, /*#__PURE__*/React.createElement(Component, (0, _extends2["default"])({}, props, this.state.data, {
@@ -717,7 +720,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
717
720
  };
718
721
 
719
722
  return _class;
720
- }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _temp;
723
+ }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
721
724
  }
722
725
  /**
723
726
  * Wrap the basic `createContainer()` function with logic to adapt to the
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
15
 
@@ -153,6 +152,7 @@ var ReactRelayQueryFetcher = /*#__PURE__*/function () {
153
152
  };
154
153
 
155
154
  if (onDataChange && this._fetchOptions.onDataChangeCallbacks.indexOf(onDataChange) === -1) {
155
+ // $FlowFixMe[incompatible-use]
156
156
  this._fetchOptions.onDataChangeCallbacks.push(onDataChange);
157
157
  }
158
158
 
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
15
 
@@ -31,7 +30,6 @@ var areEqual = require("fbjs/lib/areEqual");
31
30
  var React = require('react');
32
31
 
33
32
  var _require = require('relay-runtime'),
34
- RelayFeatureFlags = _require.RelayFeatureFlags,
35
33
  createOperationDescriptor = _require.createOperationDescriptor,
36
34
  deepFreeze = _require.deepFreeze,
37
35
  getRequest = _require.getRequest;
@@ -132,7 +130,7 @@ var ReactRelayQueryRenderer = /*#__PURE__*/function (_React$Component) {
132
130
  _proto.componentDidMount = function componentDidMount() {
133
131
  var _this2 = this;
134
132
 
135
- if (RelayFeatureFlags.ENABLE_QUERY_RENDERER_OFFSCREEN_SUPPORT === true && this._maybeHiddenOrFastRefresh === true) {
133
+ if (this._maybeHiddenOrFastRefresh === true) {
136
134
  // This block only runs if the component has previously "unmounted"
137
135
  // due to it being hidden by the Offscreen API, or during fast refresh.
138
136
  // At this point, the current cached resource will have been disposed
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var React = require('react');