react-relay 14.1.0 → 16.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/ReactRelayContainerUtils.js.flow +1 -0
  2. package/ReactRelayContext.js +1 -1
  3. package/ReactRelayContext.js.flow +1 -0
  4. package/ReactRelayFragmentContainer.js.flow +6 -2
  5. package/ReactRelayFragmentMockRenderer.js.flow +1 -0
  6. package/ReactRelayLocalQueryRenderer.js.flow +5 -3
  7. package/ReactRelayPaginationContainer.js.flow +21 -12
  8. package/ReactRelayQueryFetcher.js.flow +20 -10
  9. package/ReactRelayQueryRenderer.js.flow +15 -11
  10. package/ReactRelayQueryRendererContext.js.flow +1 -0
  11. package/ReactRelayRefetchContainer.js.flow +9 -5
  12. package/ReactRelayTestMocker.js.flow +3 -1
  13. package/ReactRelayTypes.js.flow +2 -0
  14. package/RelayContext.js.flow +1 -0
  15. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -1
  16. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +1 -0
  17. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +1 -0
  18. package/__flowtests__/RelayModern-flowtest.js.flow +1 -0
  19. package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +1 -0
  20. package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +1 -0
  21. package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +1 -0
  22. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +1 -0
  23. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +3 -1
  24. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +3 -1
  25. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +4 -2
  26. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +3 -1
  27. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +4 -2
  28. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +3 -1
  29. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +4 -2
  30. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +4 -2
  31. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +3 -1
  32. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +3 -1
  33. package/assertFragmentMap.js.flow +1 -0
  34. package/buildReactRelayContainer.js.flow +10 -6
  35. package/getRootVariablesForFragments.js.flow +1 -1
  36. package/hooks.js +1 -1
  37. package/hooks.js.flow +4 -0
  38. package/index.js +1 -1
  39. package/index.js.flow +4 -0
  40. package/isRelayEnvironment.js.flow +1 -0
  41. package/jest-react/enqueueTask.js.flow +1 -1
  42. package/jest-react/index.js.flow +1 -1
  43. package/jest-react/internalAct.js.flow +1 -1
  44. package/legacy.js +1 -1
  45. package/legacy.js.flow +1 -0
  46. package/lib/ReactRelayContainerUtils.js +0 -11
  47. package/lib/ReactRelayContext.js +1 -12
  48. package/lib/ReactRelayFragmentContainer.js +23 -122
  49. package/lib/ReactRelayFragmentMockRenderer.js +0 -12
  50. package/lib/ReactRelayLocalQueryRenderer.js +12 -41
  51. package/lib/ReactRelayPaginationContainer.js +45 -341
  52. package/lib/ReactRelayQueryFetcher.js +36 -111
  53. package/lib/ReactRelayQueryRenderer.js +29 -137
  54. package/lib/ReactRelayQueryRendererContext.js +0 -10
  55. package/lib/ReactRelayRefetchContainer.js +33 -166
  56. package/lib/ReactRelayTestMocker.js +18 -128
  57. package/lib/ReactRelayTypes.js +0 -9
  58. package/lib/RelayContext.js +0 -23
  59. package/lib/assertFragmentMap.js +0 -16
  60. package/lib/buildReactRelayContainer.js +7 -41
  61. package/lib/getRootVariablesForFragments.js +2 -19
  62. package/lib/hooks.js +3 -30
  63. package/lib/index.js +3 -39
  64. package/lib/isRelayEnvironment.js +1 -16
  65. package/lib/jest-react/enqueueTask.js +1 -25
  66. package/lib/jest-react/index.js +0 -1
  67. package/lib/jest-react/internalAct.js +2 -51
  68. package/lib/legacy.js +0 -20
  69. package/lib/multi-actor/ActorChange.js +0 -14
  70. package/lib/multi-actor/index.js +0 -10
  71. package/lib/multi-actor/useRelayActorEnvironment.js +2 -16
  72. package/lib/relay-hooks/EntryPointContainer.react.js +7 -23
  73. package/lib/relay-hooks/EntryPointTypes.flow.js +0 -10
  74. package/lib/relay-hooks/FragmentResource.js +130 -280
  75. package/lib/relay-hooks/HooksImplementation.js +0 -14
  76. package/lib/relay-hooks/InternalLogger.js +0 -11
  77. package/lib/relay-hooks/LRUCache.js +0 -39
  78. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +27 -65
  79. package/lib/relay-hooks/MatchContainer.js +9 -111
  80. package/lib/relay-hooks/NestedRelayEntryPointBuilderUtils.js +9 -0
  81. package/lib/relay-hooks/ProfilerContext.js +0 -14
  82. package/lib/relay-hooks/QueryResource.js +14 -149
  83. package/lib/relay-hooks/RelayEnvironmentProvider.js +3 -17
  84. package/lib/relay-hooks/SuspenseResource.js +2 -59
  85. package/lib/relay-hooks/loadEntryPoint.js +10 -45
  86. package/lib/relay-hooks/loadQuery.js +29 -169
  87. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +8 -58
  88. package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +6 -24
  89. package/lib/relay-hooks/react-cache/RelayReactCache.js +4 -20
  90. package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +13 -102
  91. package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +18 -75
  92. package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +79 -222
  93. package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +3 -27
  94. package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +11 -33
  95. package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +62 -85
  96. package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +20 -63
  97. package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +53 -179
  98. package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +5 -27
  99. package/lib/relay-hooks/useBlockingPaginationFragment.js +58 -121
  100. package/lib/relay-hooks/useClientQuery.js +0 -21
  101. package/lib/relay-hooks/useEntryPointLoader.js +12 -100
  102. package/lib/relay-hooks/useFetchTrackingRef.js +6 -33
  103. package/lib/relay-hooks/useFragment.js +5 -32
  104. package/lib/relay-hooks/useFragmentNode.js +14 -55
  105. package/lib/relay-hooks/useIsMountedRef.js +2 -14
  106. package/lib/relay-hooks/useIsOperationNodeActive.js +6 -29
  107. package/lib/relay-hooks/useIsParentQueryActive.js +1 -15
  108. package/lib/relay-hooks/useLazyLoadQuery.js +2 -23
  109. package/lib/relay-hooks/useLazyLoadQueryNode.js +18 -63
  110. package/lib/relay-hooks/useLoadMoreFunction.js +44 -100
  111. package/lib/relay-hooks/useMemoOperationDescriptor.js +4 -23
  112. package/lib/relay-hooks/useMemoVariables.js +8 -43
  113. package/lib/relay-hooks/useMutation.js +6 -34
  114. package/lib/relay-hooks/usePaginationFragment.js +49 -89
  115. package/lib/relay-hooks/usePreloadedQuery.js +10 -54
  116. package/lib/relay-hooks/useQueryLoader.js +18 -116
  117. package/lib/relay-hooks/useRefetchableFragment.js +4 -30
  118. package/lib/relay-hooks/useRefetchableFragmentNode.js +58 -184
  119. package/lib/relay-hooks/useRelayEnvironment.js +2 -16
  120. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +2 -20
  121. package/lib/relay-hooks/useSubscribeToInvalidationState.js +3 -28
  122. package/lib/relay-hooks/useSubscription.js +3 -22
  123. package/lib/relay-hooks/useUnsafeRef_DEPRECATED.js +12 -0
  124. package/multi-actor/ActorChange.js.flow +1 -1
  125. package/multi-actor/index.js.flow +1 -1
  126. package/multi-actor/useRelayActorEnvironment.js.flow +2 -2
  127. package/package.json +2 -2
  128. package/react-relay-hooks.js +2 -2
  129. package/react-relay-hooks.min.js +2 -2
  130. package/react-relay-legacy.js +2 -2
  131. package/react-relay-legacy.min.js +2 -2
  132. package/react-relay.js +2 -2
  133. package/react-relay.min.js +2 -2
  134. package/relay-hooks/EntryPointContainer.react.js.flow +6 -1
  135. package/relay-hooks/EntryPointTypes.flow.js.flow +23 -20
  136. package/relay-hooks/FragmentResource.js.flow +148 -34
  137. package/relay-hooks/HooksImplementation.js.flow +1 -1
  138. package/relay-hooks/InternalLogger.js.flow +1 -1
  139. package/relay-hooks/LRUCache.js.flow +1 -1
  140. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +19 -10
  141. package/relay-hooks/MatchContainer.js.flow +1 -1
  142. package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +51 -0
  143. package/relay-hooks/ProfilerContext.js.flow +1 -1
  144. package/relay-hooks/QueryResource.js.flow +25 -5
  145. package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -2
  146. package/relay-hooks/SuspenseResource.js.flow +1 -1
  147. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -1
  148. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +9 -7
  149. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +3 -1
  150. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +3 -1
  151. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +40 -33
  152. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +1 -1
  153. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +38 -32
  154. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +20 -18
  155. package/relay-hooks/__flowtests__/utils.js.flow +13 -2
  156. package/relay-hooks/loadEntryPoint.js.flow +15 -8
  157. package/relay-hooks/loadQuery.js.flow +32 -8
  158. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +5 -6
  159. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +17 -10
  160. package/relay-hooks/react-cache/RelayReactCache.js.flow +1 -1
  161. package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +4 -4
  162. package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +5 -4
  163. package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +32 -14
  164. package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +4 -10
  165. package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +1 -1
  166. package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +39 -49
  167. package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +1 -2
  168. package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +29 -16
  169. package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +17 -33
  170. package/relay-hooks/useBlockingPaginationFragment.js.flow +85 -58
  171. package/relay-hooks/useClientQuery.js.flow +3 -3
  172. package/relay-hooks/useEntryPointLoader.js.flow +10 -6
  173. package/relay-hooks/useFetchTrackingRef.js.flow +5 -4
  174. package/relay-hooks/useFragment.js.flow +2 -2
  175. package/relay-hooks/useFragmentNode.js.flow +7 -6
  176. package/relay-hooks/useIsMountedRef.js.flow +1 -1
  177. package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
  178. package/relay-hooks/useIsParentQueryActive.js.flow +1 -1
  179. package/relay-hooks/useLazyLoadQuery.js.flow +2 -2
  180. package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -2
  181. package/relay-hooks/useLoadMoreFunction.js.flow +27 -16
  182. package/relay-hooks/useMemoOperationDescriptor.js.flow +3 -3
  183. package/relay-hooks/useMemoVariables.js.flow +13 -29
  184. package/relay-hooks/useMutation.js.flow +30 -13
  185. package/relay-hooks/usePaginationFragment.js.flow +55 -54
  186. package/relay-hooks/usePreloadedQuery.js.flow +47 -22
  187. package/relay-hooks/useQueryLoader.js.flow +78 -21
  188. package/relay-hooks/useRefetchableFragment.js.flow +65 -33
  189. package/relay-hooks/useRefetchableFragmentNode.js.flow +38 -17
  190. package/relay-hooks/useRelayEnvironment.js.flow +2 -2
  191. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +3 -3
  192. package/relay-hooks/useSubscribeToInvalidationState.js.flow +2 -2
  193. package/relay-hooks/useSubscription.js.flow +1 -1
  194. package/relay-hooks/useUnsafeRef_DEPRECATED.js.flow +25 -0
  195. package/lib/readContext.js +0 -27
  196. package/readContext.js.flow +0 -29
@@ -1,217 +1,53 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- *
8
- * @format
9
- */
10
1
  'use strict';
11
2
 
12
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
13
-
14
4
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
-
16
5
  var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
17
-
18
6
  var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
19
-
20
7
  var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));
21
-
22
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
9
  var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
25
-
26
10
  var _excluded = ["componentRef"],
27
- _excluded2 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"],
28
- _excluded3 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
29
-
11
+ _excluded2 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"],
12
+ _excluded3 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
30
13
  var buildReactRelayContainer = require('./buildReactRelayContainer');
31
-
32
14
  var getRootVariablesForFragments = require('./getRootVariablesForFragments');
33
-
34
15
  var _require = require('./ReactRelayContainerUtils'),
35
- getComponentName = _require.getComponentName,
36
- getContainerName = _require.getContainerName;
37
-
16
+ getComponentName = _require.getComponentName,
17
+ getContainerName = _require.getContainerName;
38
18
  var ReactRelayContext = require('./ReactRelayContext');
39
-
40
19
  var ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
41
-
42
20
  var _require2 = require('./RelayContext'),
43
- assertRelayContext = _require2.assertRelayContext;
44
-
21
+ assertRelayContext = _require2.assertRelayContext;
45
22
  var areEqual = require("fbjs/lib/areEqual");
46
-
47
23
  var invariant = require('invariant');
48
-
49
24
  var React = require('react');
50
-
51
25
  var _require3 = require('relay-runtime'),
52
- ConnectionInterface = _require3.ConnectionInterface,
53
- Observable = _require3.Observable,
54
- RelayFeatureFlags = _require3.RelayFeatureFlags,
55
- createFragmentSpecResolver = _require3.createFragmentSpecResolver,
56
- createOperationDescriptor = _require3.createOperationDescriptor,
57
- getDataIDsFromObject = _require3.getDataIDsFromObject,
58
- getRequest = _require3.getRequest,
59
- getVariablesFromObject = _require3.getVariablesFromObject,
60
- isScalarAndEqual = _require3.isScalarAndEqual;
61
-
26
+ ConnectionInterface = _require3.ConnectionInterface,
27
+ Observable = _require3.Observable,
28
+ RelayFeatureFlags = _require3.RelayFeatureFlags,
29
+ createFragmentSpecResolver = _require3.createFragmentSpecResolver,
30
+ createOperationDescriptor = _require3.createOperationDescriptor,
31
+ getDataIDsFromObject = _require3.getDataIDsFromObject,
32
+ getRequest = _require3.getRequest,
33
+ getVariablesFromObject = _require3.getVariablesFromObject,
34
+ isScalarAndEqual = _require3.isScalarAndEqual;
62
35
  var warning = require("fbjs/lib/warning");
63
-
64
36
  var FORWARD = 'forward';
65
-
66
- /**
67
- * Extends the functionality of RelayFragmentContainer by providing a mechanism
68
- * to load more data from a connection.
69
- *
70
- * # Configuring a PaginationContainer
71
- *
72
- * PaginationContainer accepts the standard FragmentContainer arguments and an
73
- * additional `connectionConfig` argument:
74
- *
75
- * - `Component`: the component to be wrapped/rendered.
76
- * - `fragments`: an object whose values are `graphql` fragments. The object
77
- * keys determine the prop names by which fragment data is available.
78
- * - `connectionConfig`: an object that determines how to load more connection
79
- * data. Details below.
80
- *
81
- * # Loading More Data
82
- *
83
- * Use `props.relay.hasMore()` to determine if there are more items to load.
84
- *
85
- * ```
86
- * hasMore(): boolean
87
- * ```
88
- *
89
- * Use `props.relay.isLoading()` to determine if a previous call to `loadMore()`
90
- * is still pending. This is convenient for avoiding duplicate load calls.
91
- *
92
- * ```
93
- * isLoading(): boolean
94
- * ```
95
- *
96
- * Use `props.relay.loadMore()` to load more items. This will return null if
97
- * there are no more items to fetch, otherwise it will fetch more items and
98
- * return a Disposable that can be used to cancel the fetch.
99
- *
100
- * `pageSize` should be the number of *additional* items to fetch (not the
101
- * total).
102
- *
103
- * ```
104
- * loadMore(pageSize: number, callback: ?(error: ?Error) => void): ?Disposable
105
- * ```
106
- *
107
- * A complete example:
108
- *
109
- * ```
110
- * class Foo extends React.Component {
111
- * ...
112
- * _onEndReached() {
113
- * if (!this.props.relay.hasMore() || this.props.relay.isLoading()) {
114
- * return;
115
- * }
116
- * this.props.relay.loadMore(10);
117
- * }
118
- * ...
119
- * }
120
- * ```
121
- *
122
- * # Connection Config
123
- *
124
- * Here's an example, followed by details of each config property:
125
- *
126
- * ```
127
- * ReactRelayPaginationContainer.createContainer(
128
- * Component,
129
- * {
130
- * user: graphql`fragment FriendsFragment on User {
131
- * friends(after: $afterCursor first: $count) @connection {
132
- * edges { ... }
133
- * pageInfo {
134
- * startCursor
135
- * endCursor
136
- * hasNextPage
137
- * hasPreviousPage
138
- * }
139
- * }
140
- * }`,
141
- * },
142
- * {
143
- * direction: 'forward',
144
- * getConnectionFromProps(props) {
145
- * return props.user && props.user.friends;
146
- * },
147
- * getFragmentVariables(vars, totalCount) {
148
- * // The component presumably wants *all* edges, not just those after
149
- * // the cursor, so notice that we don't set $afterCursor here.
150
- * return {
151
- * ...vars,
152
- * count: totalCount,
153
- * };
154
- * },
155
- * getVariables(props, {count, cursor}, fragmentVariables) {
156
- * return {
157
- * id: props.user.id,
158
- * afterCursor: cursor,
159
- * count,
160
- * },
161
- * },
162
- * query: graphql`
163
- * query FriendsQuery($id: ID!, $afterCursor: ID, $count: Int!) {
164
- * node(id: $id) {
165
- * ...FriendsFragment
166
- * }
167
- * }
168
- * `,
169
- * }
170
- * );
171
- * ```
172
- *
173
- * ## Config Properties
174
- *
175
- * - `direction`: Either "forward" to indicate forward pagination using
176
- * after/first, or "backward" to indicate backward pagination using
177
- * before/last.
178
- * - `getConnectionFromProps(props)`: PaginationContainer doesn't magically know
179
- * which connection data you mean to fetch more of (a container might fetch
180
- * multiple connections, but can only paginate one of them). This function is
181
- * given the fragment props only (not full props), and should return the
182
- * connection data. See the above example that returns the friends data via
183
- * `props.user.friends`.
184
- * - `getFragmentVariables(previousVars, totalCount)`: Given the previous variables
185
- * and the new total number of items, get the variables to use when reading
186
- * your fragments. Typically this means setting whatever your local "count"
187
- * variable is to the value of `totalCount`. See the example.
188
- * - `getVariables(props, {count, cursor})`: Get the variables to use when
189
- * fetching the pagination `query`. You may determine the root object id from
190
- * props (see the example that uses `props.user.id`) and may also set whatever
191
- * variables you use for the after/first/before/last calls based on the count
192
- * and cursor.
193
- * - `query`: A query to use when fetching more connection data. This should
194
- * typically reference one of the container's fragment (as in the example)
195
- * to ensure that all the necessary fields for sub-components are fetched.
196
- */
197
37
  function createGetConnectionFromProps(metadata) {
198
38
  var path = metadata.path;
199
39
  !path ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Unable to synthesize a ' + 'getConnectionFromProps function.') : invariant(false) : void 0;
200
40
  return function (props) {
201
41
  var data = props[metadata.fragmentName];
202
-
203
42
  for (var i = 0; i < path.length; i++) {
204
43
  if (!data || typeof data !== 'object') {
205
44
  return null;
206
45
  }
207
-
208
46
  data = data[path[i]];
209
47
  }
210
-
211
48
  return data;
212
49
  };
213
50
  }
214
-
215
51
  function createGetFragmentVariables(metadata) {
216
52
  var countVariable = metadata.count;
217
53
  !countVariable ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Unable to synthesize a ' + 'getFragmentVariables function.') : invariant(false) : void 0;
@@ -219,21 +55,15 @@ function createGetFragmentVariables(metadata) {
219
55
  return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, prevVars), {}, (0, _defineProperty2["default"])({}, countVariable, totalCount));
220
56
  };
221
57
  }
222
-
223
58
  function findConnectionMetadata(fragments) {
224
59
  var foundConnectionMetadata = null;
225
60
  var isRelayModern = false;
226
-
227
61
  for (var fragmentName in fragments) {
228
62
  var fragment = fragments[fragmentName];
229
- var connectionMetadata = fragment.metadata && fragment.metadata.connection; // HACK: metadata is always set to `undefined` in classic. In modern, even
230
- // if empty, it is set to null (never undefined). We use that knowlege to
231
- // check if we're dealing with classic or modern
232
-
63
+ var connectionMetadata = fragment.metadata && fragment.metadata.connection;
233
64
  if (fragment.metadata !== undefined) {
234
65
  isRelayModern = true;
235
66
  }
236
-
237
67
  if (connectionMetadata) {
238
68
  !(connectionMetadata.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Only a single @connection is ' + 'supported, `%s` has %s.', fragmentName, connectionMetadata.length) : invariant(false) : void 0;
239
69
  !!foundConnectionMetadata ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Only a single fragment with ' + '@connection is supported.') : invariant(false) : void 0;
@@ -242,11 +72,9 @@ function findConnectionMetadata(fragments) {
242
72
  });
243
73
  }
244
74
  }
245
-
246
75
  !(!isRelayModern || foundConnectionMetadata !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: A @connection directive must be present.') : invariant(false) : void 0;
247
76
  return foundConnectionMetadata || {};
248
77
  }
249
-
250
78
  function toObserver(observerOrCallback) {
251
79
  return typeof observerOrCallback === 'function' ? {
252
80
  error: observerOrCallback,
@@ -256,10 +84,8 @@ function toObserver(observerOrCallback) {
256
84
  }
257
85
  } : observerOrCallback || {};
258
86
  }
259
-
260
87
  function createContainerWithFragments(Component, fragments, connectionConfig) {
261
88
  var _class;
262
-
263
89
  var componentName = getComponentName(Component);
264
90
  var containerName = getContainerName(Component);
265
91
  var metadata = findConnectionMetadata(fragments);
@@ -269,10 +95,8 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
269
95
  var getFragmentVariables = connectionConfig.getFragmentVariables || createGetFragmentVariables(metadata);
270
96
  return _class = /*#__PURE__*/function (_React$Component) {
271
97
  (0, _inheritsLoose2["default"])(_class, _React$Component);
272
-
273
98
  function _class(props) {
274
99
  var _props$__rootIsQueryR, _this;
275
-
276
100
  _this = _React$Component.call(this, props) || this;
277
101
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_handleFragmentDataUpdate", function () {
278
102
  _this.setState({
@@ -281,7 +105,6 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
281
105
  });
282
106
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_hasMore", function () {
283
107
  var connectionData = _this._getConnectionData();
284
-
285
108
  return !!(connectionData && connectionData.hasMore && connectionData.cursor);
286
109
  });
287
110
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_isLoading", function () {
@@ -293,18 +116,15 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
293
116
  dispose: function dispose() {}
294
117
  };
295
118
  }
296
-
297
119
  _this._refetchVariables = refetchVariables;
298
120
  var paginatingVariables = {
299
121
  count: totalCount,
300
122
  cursor: null,
301
123
  totalCount: totalCount
302
124
  };
303
-
304
125
  var fetch = _this._fetchPage(paginatingVariables, toObserver(observerOrCallback), {
305
126
  force: true
306
127
  });
307
-
308
128
  return {
309
129
  dispose: fetch.unsubscribe
310
130
  };
@@ -315,28 +135,21 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
315
135
  dispose: function dispose() {}
316
136
  };
317
137
  }
318
-
319
138
  var observer = toObserver(observerOrCallback);
320
-
321
139
  var connectionData = _this._getConnectionData();
322
-
323
140
  if (!connectionData) {
324
141
  Observable.create(function (sink) {
325
142
  return sink.complete();
326
143
  }).subscribe(observer);
327
144
  return null;
328
145
  }
329
-
330
146
  var totalCount = connectionData.edgeCount + pageSize;
331
-
332
147
  if (options && options.force) {
333
148
  return _this._refetchConnection(totalCount, observerOrCallback);
334
149
  }
335
-
336
150
  var _ConnectionInterface$ = ConnectionInterface.get(),
337
- END_CURSOR = _ConnectionInterface$.END_CURSOR,
338
- START_CURSOR = _ConnectionInterface$.START_CURSOR;
339
-
151
+ END_CURSOR = _ConnectionInterface$.END_CURSOR,
152
+ START_CURSOR = _ConnectionInterface$.START_CURSOR;
340
153
  var cursor = connectionData.cursor;
341
154
  process.env.NODE_ENV !== "production" ? warning(cursor != null && cursor !== '', 'ReactRelayPaginationContainer: Cannot `loadMore` without valid `%s` (got `%s`)', direction === FORWARD ? END_CURSOR : START_CURSOR, cursor) : void 0;
342
155
  var paginatingVariables = {
@@ -344,9 +157,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
344
157
  cursor: cursor,
345
158
  totalCount: totalCount
346
159
  };
347
-
348
160
  var fetch = _this._fetchPage(paginatingVariables, observer, options);
349
-
350
161
  return {
351
162
  dispose: fetch.unsubscribe
352
163
  };
@@ -356,13 +167,11 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
356
167
  _this._isARequestInFlight = false;
357
168
  _this._refetchSubscription = null;
358
169
  _this._refetchVariables = null;
359
-
360
170
  if (RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT === true) {
361
171
  _this._resolver = createFragmentSpecResolver(relayContext, containerName, fragments, props, rootIsQueryRenderer);
362
172
  } else {
363
173
  _this._resolver = createFragmentSpecResolver(relayContext, containerName, fragments, props, rootIsQueryRenderer, _this._handleFragmentDataUpdate);
364
174
  }
365
-
366
175
  _this.state = {
367
176
  data: _this._resolver.resolve(),
368
177
  prevContext: relayContext,
@@ -374,17 +183,13 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
374
183
  _this._hasFetched = false;
375
184
  return _this;
376
185
  }
377
-
378
186
  var _proto = _class.prototype;
379
-
380
187
  _proto.componentDidMount = function componentDidMount() {
381
188
  this._isUnmounted = false;
382
-
383
189
  if (RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT === true) {
384
190
  this._subscribeToNewResolverAndRerenderIfStoreHasChanged();
385
191
  }
386
192
  };
387
-
388
193
  _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
389
194
  if (RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT === true) {
390
195
  if (prevState.resolverGeneration !== this.state.resolverGeneration) {
@@ -393,40 +198,23 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
393
198
  this._rerenderIfStoreHasChanged();
394
199
  }
395
200
  }
396
- }
397
- /**
398
- * When new props are received, read data for the new props and subscribe
399
- * for updates. Props may be the same in which case previous data and
400
- * subscriptions can be reused.
401
- */
402
- ;
403
-
201
+ };
404
202
  _proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps) {
405
203
  var _this2 = this;
406
-
407
204
  var _nextProps$__rootIsQu;
408
-
409
205
  var relayContext = assertRelayContext(nextProps.__relayContext);
410
206
  var rootIsQueryRenderer = (_nextProps$__rootIsQu = nextProps.__rootIsQueryRenderer) !== null && _nextProps$__rootIsQu !== void 0 ? _nextProps$__rootIsQu : false;
411
207
  var prevIDs = getDataIDsFromObject(fragments, this.props);
412
208
  var nextIDs = getDataIDsFromObject(fragments, nextProps);
413
209
  var prevRootVariables = getRootVariablesForFragments(fragments, this.props);
414
- var nextRootVariables = getRootVariablesForFragments(fragments, nextProps); // If the environment has changed or props point to new records then
415
- // previously fetched data and any pending fetches no longer apply:
416
- // - Existing references are on the old environment.
417
- // - Existing references are based on old variables.
418
- // - Pending fetches are for the previous records.
419
-
210
+ var nextRootVariables = getRootVariablesForFragments(fragments, nextProps);
420
211
  if (relayContext.environment !== this.state.prevContext.environment || !areEqual(prevRootVariables, nextRootVariables) || !areEqual(prevIDs, nextIDs)) {
421
- this._cleanup(); // Child containers rely on context.relay being mutated (for gDSFP).
422
-
423
-
212
+ this._cleanup();
424
213
  if (RelayFeatureFlags.ENABLE_CONTAINERS_SUBSCRIBE_ON_COMMIT === true) {
425
214
  this._resolver = createFragmentSpecResolver(relayContext, containerName, fragments, nextProps, rootIsQueryRenderer);
426
215
  } else {
427
216
  this._resolver = createFragmentSpecResolver(relayContext, containerName, fragments, nextProps, rootIsQueryRenderer, this._handleFragmentDataUpdate);
428
217
  }
429
-
430
218
  this.setState(function (prevState) {
431
219
  return {
432
220
  prevContext: relayContext,
@@ -438,35 +226,24 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
438
226
  } else if (!this._hasFetched) {
439
227
  this._resolver.setProps(nextProps);
440
228
  }
441
-
442
229
  var data = this._resolver.resolve();
443
-
444
230
  if (data !== this.state.data) {
445
231
  this.setState({
446
232
  data: data
447
233
  });
448
234
  }
449
235
  };
450
-
451
236
  _proto.componentWillUnmount = function componentWillUnmount() {
452
237
  this._isUnmounted = true;
453
-
454
238
  this._cleanup();
455
239
  };
456
-
457
240
  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
458
- // Short-circuit if any Relay-related data has changed
459
241
  if (nextState.data !== this.state.data || nextState.relayProp !== this.state.relayProp || nextState.resolverGeneration !== this.state.resolverGeneration) {
460
242
  return true;
461
- } // Otherwise, for convenience short-circuit if all non-Relay props
462
- // are scalar and equal
463
-
464
-
243
+ }
465
244
  var keys = Object.keys(nextProps);
466
-
467
245
  for (var ii = 0; ii < keys.length; ii++) {
468
246
  var key = keys[ii];
469
-
470
247
  if (key === '__relayContext') {
471
248
  if (nextState.prevContext.environment !== this.state.prevContext.environment) {
472
249
  return true;
@@ -477,10 +254,8 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
477
254
  }
478
255
  }
479
256
  }
480
-
481
257
  return false;
482
258
  };
483
-
484
259
  _proto._buildRelayProp = function _buildRelayProp(relayContext) {
485
260
  return {
486
261
  hasMore: this._hasMore,
@@ -490,115 +265,83 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
490
265
  environment: relayContext.environment
491
266
  };
492
267
  };
493
-
494
268
  _proto._rerenderIfStoreHasChanged = function _rerenderIfStoreHasChanged() {
495
- var data = this.state.data; // External values could change between render and commit.
496
- // Check for this case, even though it requires an extra store read.
497
-
269
+ var data = this.state.data;
498
270
  var maybeNewData = this._resolver.resolve();
499
-
500
271
  if (data !== maybeNewData) {
501
272
  this.setState({
502
273
  data: maybeNewData
503
274
  });
504
275
  }
505
276
  };
506
-
507
277
  _proto._subscribeToNewResolverAndRerenderIfStoreHasChanged = function _subscribeToNewResolverAndRerenderIfStoreHasChanged() {
508
278
  var data = this.state.data;
509
-
510
- var maybeNewData = this._resolver.resolve(); // Event listeners are only safe to add during the commit phase,
511
- // So they won't leak if render is interrupted or errors.
512
-
513
-
514
- this._resolver.setCallback(this.props, this._handleFragmentDataUpdate); // External values could change between render and commit.
515
- // Check for this case, even though it requires an extra store read.
516
-
517
-
279
+ var maybeNewData = this._resolver.resolve();
280
+ this._resolver.setCallback(this.props, this._handleFragmentDataUpdate);
518
281
  if (data !== maybeNewData) {
519
282
  this.setState({
520
283
  data: maybeNewData
521
284
  });
522
285
  }
523
- }
524
- /**
525
- * Render new data for the existing props/context.
526
- */
527
- ;
528
-
286
+ };
529
287
  _proto._getConnectionData = function _getConnectionData() {
530
- // Extract connection data and verify there are more edges to fetch
531
288
  var _this$props = this.props,
532
- _ = _this$props.componentRef,
533
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
289
+ _ = _this$props.componentRef,
290
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
534
291
  var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
535
292
  var connectionData = getConnectionFromProps(props);
536
-
537
293
  if (connectionData == null) {
538
294
  return null;
539
295
  }
540
-
541
296
  var _ConnectionInterface$2 = ConnectionInterface.get(),
542
- EDGES = _ConnectionInterface$2.EDGES,
543
- PAGE_INFO = _ConnectionInterface$2.PAGE_INFO,
544
- HAS_NEXT_PAGE = _ConnectionInterface$2.HAS_NEXT_PAGE,
545
- HAS_PREV_PAGE = _ConnectionInterface$2.HAS_PREV_PAGE,
546
- END_CURSOR = _ConnectionInterface$2.END_CURSOR,
547
- START_CURSOR = _ConnectionInterface$2.START_CURSOR;
548
-
297
+ EDGES = _ConnectionInterface$2.EDGES,
298
+ PAGE_INFO = _ConnectionInterface$2.PAGE_INFO,
299
+ HAS_NEXT_PAGE = _ConnectionInterface$2.HAS_NEXT_PAGE,
300
+ HAS_PREV_PAGE = _ConnectionInterface$2.HAS_PREV_PAGE,
301
+ END_CURSOR = _ConnectionInterface$2.END_CURSOR,
302
+ START_CURSOR = _ConnectionInterface$2.START_CURSOR;
549
303
  !(typeof connectionData === 'object') ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`' + 'to return `null` or a plain object with %s and %s properties, got `%s`.', componentName, EDGES, PAGE_INFO, connectionData) : invariant(false) : void 0;
550
304
  var edges = connectionData[EDGES];
551
305
  var pageInfo = connectionData[PAGE_INFO];
552
-
553
306
  if (edges == null || pageInfo == null) {
554
307
  return null;
555
308
  }
556
-
557
309
  !Array.isArray(edges) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`' + 'to return an object with %s: Array, got `%s`.', componentName, EDGES, edges) : invariant(false) : void 0;
558
310
  !(typeof pageInfo === 'object') ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Expected `getConnectionFromProps()` in `%s`' + 'to return an object with %s: Object, got `%s`.', componentName, PAGE_INFO, pageInfo) : invariant(false) : void 0;
559
311
  var hasMore = direction === FORWARD ? pageInfo[HAS_NEXT_PAGE] : pageInfo[HAS_PREV_PAGE];
560
312
  var cursor = direction === FORWARD ? pageInfo[END_CURSOR] : pageInfo[START_CURSOR];
561
-
562
313
  if (typeof hasMore !== 'boolean' || edges.length !== 0 && typeof cursor === 'undefined') {
563
314
  process.env.NODE_ENV !== "production" ? warning(false, 'ReactRelayPaginationContainer: Cannot paginate without %s fields in `%s`. ' + 'Be sure to fetch %s (got `%s`) and %s (got `%s`).', PAGE_INFO, componentName, direction === FORWARD ? HAS_NEXT_PAGE : HAS_PREV_PAGE, hasMore, direction === FORWARD ? END_CURSOR : START_CURSOR, cursor) : void 0;
564
315
  return null;
565
316
  }
566
-
567
317
  return {
568
318
  cursor: cursor,
569
319
  edgeCount: edges.length,
570
320
  hasMore: hasMore
571
321
  };
572
322
  };
573
-
574
323
  _proto._getQueryFetcher = function _getQueryFetcher() {
575
324
  if (!this._queryFetcher) {
576
325
  this._queryFetcher = new ReactRelayQueryFetcher();
577
326
  }
578
-
579
327
  return this._queryFetcher;
580
328
  };
581
-
582
329
  _proto._canFetchPage = function _canFetchPage(method) {
583
330
  if (this._isUnmounted) {
584
331
  process.env.NODE_ENV !== "production" ? warning(false, 'ReactRelayPaginationContainer: Unexpected call of `%s` ' + 'on unmounted container `%s`. It looks like some instances ' + 'of your container still trying to fetch data but they already ' + 'unmounted. Please make sure you clear all timers, intervals, async ' + 'calls, etc that may trigger `%s` call.', method, containerName, method) : void 0;
585
332
  return false;
586
333
  }
587
-
588
334
  return true;
589
335
  };
590
-
591
336
  _proto._fetchPage = function _fetchPage(paginatingVariables, observer, options) {
592
337
  var _this3 = this;
593
-
594
338
  var _assertRelayContext = assertRelayContext(this.props.__relayContext),
595
- environment = _assertRelayContext.environment;
596
-
339
+ environment = _assertRelayContext.environment;
597
340
  var _this$props2 = this.props,
598
- _ = _this$props2.componentRef,
599
- __relayContext = _this$props2.__relayContext,
600
- __rootIsQueryRenderer = _this$props2.__rootIsQueryRenderer,
601
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, _excluded2);
341
+ _ = _this$props2.componentRef,
342
+ __relayContext = _this$props2.__relayContext,
343
+ __rootIsQueryRenderer = _this$props2.__rootIsQueryRenderer,
344
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, _excluded2);
602
345
  var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
603
346
  var fragmentVariables;
604
347
  var rootVariables = getRootVariablesForFragments(fragments, restProps);
@@ -614,37 +357,20 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
614
357
  var cacheConfig = options ? {
615
358
  force: !!options.force
616
359
  } : undefined;
617
-
618
360
  if (cacheConfig != null && (options === null || options === void 0 ? void 0 : options.metadata) != null) {
619
361
  cacheConfig.metadata = options === null || options === void 0 ? void 0 : options.metadata;
620
362
  }
621
-
622
363
  var request = getRequest(connectionConfig.query);
623
364
  var operation = createOperationDescriptor(request, fetchVariables, cacheConfig);
624
365
  var refetchSubscription = null;
625
-
626
366
  if (this._refetchSubscription) {
627
367
  this._refetchSubscription.unsubscribe();
628
368
  }
629
-
630
369
  this._hasFetched = true;
631
-
632
370
  var onNext = function onNext(payload, complete) {
633
371
  var prevData = _this3._resolver.resolve();
634
-
635
372
  _this3._resolver.setVariables(getFragmentVariables(fragmentVariables, paginatingVariables.totalCount), operation.request.node);
636
-
637
- var nextData = _this3._resolver.resolve(); // Workaround slightly different handling for connection in different
638
- // core implementations:
639
- // - Classic core requires the count to be explicitly incremented
640
- // - Modern core automatically appends new items, updating the count
641
- // isn't required to see new data.
642
- //
643
- // `setState` is only required if changing the variables would change the
644
- // resolved data.
645
- // TODO #14894725: remove PaginationContainer equal check
646
-
647
-
373
+ var nextData = _this3._resolver.resolve();
648
374
  if (!areEqual(prevData, nextData)) {
649
375
  _this3.setState({
650
376
  data: nextData,
@@ -656,14 +382,12 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
656
382
  complete();
657
383
  }
658
384
  };
659
-
660
385
  var cleanup = function cleanup() {
661
386
  if (_this3._refetchSubscription === refetchSubscription) {
662
387
  _this3._refetchSubscription = null;
663
388
  _this3._isARequestInFlight = false;
664
389
  }
665
390
  };
666
-
667
391
  this._isARequestInFlight = true;
668
392
  refetchSubscription = this._getQueryFetcher().execute({
669
393
  environment: environment,
@@ -672,13 +396,11 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
672
396
  }).mergeMap(function (payload) {
673
397
  return Observable.create(function (sink) {
674
398
  onNext(payload, function () {
675
- sink.next(); // pass void to public observer's `next`
676
-
399
+ sink.next();
677
400
  sink.complete();
678
401
  });
679
402
  });
680
- }) // use do instead of finally so that observer's `complete` fires after cleanup
681
- ["do"]({
403
+ })["do"]({
682
404
  error: cleanup,
683
405
  complete: cleanup,
684
406
  unsubscribe: cleanup
@@ -686,31 +408,25 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
686
408
  this._refetchSubscription = this._isARequestInFlight ? refetchSubscription : null;
687
409
  return refetchSubscription;
688
410
  };
689
-
690
411
  _proto._cleanup = function _cleanup() {
691
412
  this._resolver.dispose();
692
-
693
413
  this._refetchVariables = null;
694
414
  this._hasFetched = false;
695
-
696
415
  if (this._refetchSubscription) {
697
416
  this._refetchSubscription.unsubscribe();
698
-
699
417
  this._refetchSubscription = null;
700
418
  this._isARequestInFlight = false;
701
419
  }
702
-
703
420
  if (this._queryFetcher) {
704
421
  this._queryFetcher.dispose();
705
422
  }
706
423
  };
707
-
708
424
  _proto.render = function render() {
709
425
  var _this$props3 = this.props,
710
- componentRef = _this$props3.componentRef,
711
- __relayContext = _this$props3.__relayContext,
712
- __rootIsQueryRenderer = _this$props3.__rootIsQueryRenderer,
713
- props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props3, _excluded3);
426
+ componentRef = _this$props3.componentRef,
427
+ __relayContext = _this$props3.__relayContext,
428
+ __rootIsQueryRenderer = _this$props3.__rootIsQueryRenderer,
429
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props3, _excluded3);
714
430
  return /*#__PURE__*/React.createElement(ReactRelayContext.Provider, {
715
431
  value: this.state.contextForChildren
716
432
  }, /*#__PURE__*/React.createElement(Component, (0, _extends2["default"])({}, props, this.state.data, {
@@ -718,26 +434,14 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
718
434
  relay: this.state.relayProp
719
435
  })));
720
436
  };
721
-
722
437
  return _class;
723
438
  }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
724
439
  }
725
- /**
726
- * Wrap the basic `createContainer()` function with logic to adapt to the
727
- * `context.relay.environment` in which it is rendered. Specifically, the
728
- * extraction of the environment-specific version of fragments in the
729
- * `fragmentSpec` is memoized once per environment, rather than once per
730
- * instance of the container constructed/rendered.
731
- */
732
-
733
-
734
440
  function createContainer(Component, fragmentSpec, connectionConfig) {
735
- // $FlowFixMe[incompatible-return]
736
441
  return buildReactRelayContainer(Component, fragmentSpec, function (ComponentClass, fragments) {
737
442
  return createContainerWithFragments(ComponentClass, fragments, connectionConfig);
738
443
  });
739
444
  }
740
-
741
445
  module.exports = {
742
446
  createContainer: createContainer
743
447
  };