react-relay 15.0.0 → 16.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. package/ReactRelayContext.js +1 -1
  2. package/ReactRelayQueryFetcher.js.flow +1 -5
  3. package/ReactRelayQueryRenderer.js.flow +9 -36
  4. package/ReactRelayTypes.js.flow +1 -0
  5. package/buildReactRelayContainer.js.flow +3 -1
  6. package/hooks.js +1 -1
  7. package/index.js +1 -1
  8. package/legacy.js +1 -1
  9. package/lib/ReactRelayContainerUtils.js +0 -11
  10. package/lib/ReactRelayContext.js +0 -11
  11. package/lib/ReactRelayFragmentContainer.js +6 -78
  12. package/lib/ReactRelayFragmentMockRenderer.js +0 -11
  13. package/lib/ReactRelayLocalQueryRenderer.js +0 -17
  14. package/lib/ReactRelayPaginationContainer.js +5 -208
  15. package/lib/ReactRelayQueryFetcher.js +2 -51
  16. package/lib/ReactRelayQueryRenderer.js +6 -94
  17. package/lib/ReactRelayQueryRendererContext.js +0 -11
  18. package/lib/ReactRelayRefetchContainer.js +5 -91
  19. package/lib/ReactRelayTestMocker.js +9 -85
  20. package/lib/ReactRelayTypes.js +0 -11
  21. package/lib/RelayContext.js +0 -21
  22. package/lib/assertFragmentMap.js +0 -15
  23. package/lib/buildReactRelayContainer.js +0 -19
  24. package/lib/getRootVariablesForFragments.js +0 -14
  25. package/lib/hooks.js +0 -15
  26. package/lib/index.js +0 -17
  27. package/lib/isRelayEnvironment.js +1 -18
  28. package/lib/jest-react/enqueueTask.js +0 -20
  29. package/lib/jest-react/internalAct.js +0 -38
  30. package/lib/legacy.js +0 -15
  31. package/lib/multi-actor/ActorChange.js +0 -11
  32. package/lib/multi-actor/index.js +0 -11
  33. package/lib/multi-actor/useRelayActorEnvironment.js +0 -11
  34. package/lib/relay-hooks/EntryPointContainer.react.js +0 -11
  35. package/lib/relay-hooks/EntryPointTypes.flow.js +1 -14
  36. package/lib/relay-hooks/FragmentResource.js +76 -132
  37. package/lib/relay-hooks/HooksImplementation.js +0 -11
  38. package/lib/relay-hooks/InternalLogger.js +0 -11
  39. package/lib/relay-hooks/LRUCache.js +0 -22
  40. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +0 -18
  41. package/lib/relay-hooks/MatchContainer.js +0 -94
  42. package/lib/relay-hooks/NestedRelayEntryPointBuilderUtils.js +9 -0
  43. package/lib/relay-hooks/ProfilerContext.js +0 -15
  44. package/lib/relay-hooks/QueryResource.js +2 -68
  45. package/lib/relay-hooks/RelayEnvironmentProvider.js +0 -11
  46. package/lib/relay-hooks/SuspenseResource.js +0 -34
  47. package/lib/relay-hooks/loadEntryPoint.js +1 -24
  48. package/lib/relay-hooks/loadQuery.js +2 -106
  49. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +2 -27
  50. package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +0 -13
  51. package/lib/relay-hooks/react-cache/RelayReactCache.js +0 -12
  52. package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +1 -36
  53. package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +3 -27
  54. package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +34 -99
  55. package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +0 -15
  56. package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +0 -16
  57. package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +1 -23
  58. package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +0 -29
  59. package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +12 -96
  60. package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +0 -14
  61. package/lib/relay-hooks/useBlockingPaginationFragment.js +0 -42
  62. package/lib/relay-hooks/useClientQuery.js +0 -18
  63. package/lib/relay-hooks/useEntryPointLoader.js +0 -69
  64. package/lib/relay-hooks/useFetchTrackingRef.js +0 -26
  65. package/lib/relay-hooks/useFragment.js +0 -17
  66. package/lib/relay-hooks/useFragmentNode.js +2 -32
  67. package/lib/relay-hooks/useIsMountedRef.js +0 -11
  68. package/lib/relay-hooks/useIsOperationNodeActive.js +0 -11
  69. package/lib/relay-hooks/useIsParentQueryActive.js +0 -11
  70. package/lib/relay-hooks/useLazyLoadQuery.js +0 -18
  71. package/lib/relay-hooks/useLazyLoadQueryNode.js +0 -35
  72. package/lib/relay-hooks/useLoadMoreFunction.js +9 -34
  73. package/lib/relay-hooks/useMemoOperationDescriptor.js +0 -11
  74. package/lib/relay-hooks/useMemoVariables.js +0 -17
  75. package/lib/relay-hooks/useMutation.js +0 -11
  76. package/lib/relay-hooks/usePaginationFragment.js +1 -26
  77. package/lib/relay-hooks/usePreloadedQuery.js +0 -27
  78. package/lib/relay-hooks/useQueryLoader.js +0 -74
  79. package/lib/relay-hooks/useRefetchableFragment.js +0 -16
  80. package/lib/relay-hooks/useRefetchableFragmentNode.js +14 -97
  81. package/lib/relay-hooks/useRelayEnvironment.js +0 -11
  82. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +0 -15
  83. package/lib/relay-hooks/useSubscribeToInvalidationState.js +0 -25
  84. package/lib/relay-hooks/useSubscription.js +0 -15
  85. package/lib/relay-hooks/useUnsafeRef_DEPRECATED.js +0 -17
  86. package/package.json +2 -2
  87. package/react-relay-hooks.js +2 -2
  88. package/react-relay-hooks.min.js +2 -2
  89. package/react-relay-legacy.js +2 -2
  90. package/react-relay-legacy.min.js +2 -2
  91. package/react-relay.js +2 -2
  92. package/react-relay.min.js +2 -2
  93. package/relay-hooks/EntryPointContainer.react.js.flow +5 -0
  94. package/relay-hooks/EntryPointTypes.flow.js.flow +20 -19
  95. package/relay-hooks/FragmentResource.js.flow +114 -26
  96. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +4 -2
  97. package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +51 -0
  98. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +7 -5
  99. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +5 -0
  100. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +5 -0
  101. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +2 -0
  102. package/relay-hooks/loadEntryPoint.js.flow +4 -2
  103. package/relay-hooks/loadQuery.js.flow +21 -1
  104. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +4 -2
  105. package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +2 -1
  106. package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +28 -10
  107. package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +3 -9
  108. package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +28 -57
  109. package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +19 -12
  110. package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +15 -31
  111. package/relay-hooks/useBlockingPaginationFragment.js.flow +2 -4
  112. package/relay-hooks/useClientQuery.js.flow +2 -2
  113. package/relay-hooks/useFragmentNode.js.flow +2 -2
  114. package/relay-hooks/useLoadMoreFunction.js.flow +15 -9
  115. package/relay-hooks/useMutation.js.flow +26 -9
  116. package/relay-hooks/usePaginationFragment.js.flow +2 -8
  117. package/relay-hooks/useQueryLoader.js.flow +2 -8
  118. package/relay-hooks/useRefetchableFragment.js.flow +3 -2
  119. package/relay-hooks/useRefetchableFragmentNode.js.flow +28 -13
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v15.0.0
2
+ * Relay v16.0.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -27,11 +27,7 @@ const {
27
27
  isRelayModernEnvironment,
28
28
  } = require('relay-runtime');
29
29
 
30
- type OnDataChange = ({
31
- error?: Error,
32
- snapshot?: Snapshot,
33
- ...
34
- }) => void;
30
+ type OnDataChange = ({error?: Error, snapshot?: Snapshot, ...}) => void;
35
31
 
36
32
  /** The external API of 'fetch' **/
37
33
  export type FetchOptions = {
@@ -27,7 +27,6 @@ const ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
27
27
  const ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext');
28
28
  const areEqual = require('areEqual');
29
29
  const React = require('react');
30
- const {RelayFeatureFlags} = require('relay-runtime');
31
30
  const {
32
31
  createOperationDescriptor,
33
32
  deepFreeze,
@@ -37,11 +36,7 @@ const {
37
36
  type RetryCallbacks = {
38
37
  handleDataChange:
39
38
  | null
40
- | (({
41
- error?: Error,
42
- snapshot?: Snapshot,
43
- ...
44
- }) => void),
39
+ | (({error?: Error, snapshot?: Snapshot, ...}) => void),
45
40
  handleRetryAfterError: null | ((error: Error) => void),
46
41
  };
47
42
 
@@ -66,14 +61,14 @@ const queryRendererContext: ReactRelayQueryRendererContextType = {
66
61
  rootIsQueryRenderer: true,
67
62
  };
68
63
 
69
- export type Props = {
64
+ export type Props = $ReadOnly<{
70
65
  cacheConfig?: ?CacheConfig,
71
66
  fetchPolicy?: 'store-and-network' | 'network-only',
72
67
  environment: IEnvironment,
73
68
  query: ?GraphQLTaggedNode,
74
69
  render: (renderProps: RenderProps<Object>) => React.Node,
75
70
  variables: Variables,
76
- };
71
+ }>;
77
72
 
78
73
  type State = {
79
74
  error: Error | null,
@@ -131,6 +126,7 @@ class ReactRelayQueryRenderer extends React.Component<Props, State> {
131
126
 
132
127
  this._maybeHiddenOrFastRefresh = false;
133
128
 
129
+ // $FlowFixMe[incompatible-type]
134
130
  this.state = {
135
131
  prevPropsEnvironment: props.environment,
136
132
  prevPropsVariables: props.variables,
@@ -149,7 +145,7 @@ class ReactRelayQueryRenderer extends React.Component<Props, State> {
149
145
  static getDerivedStateFromProps(
150
146
  nextProps: Props,
151
147
  prevState: State,
152
- ): $Shape<State> | null {
148
+ ): Partial<State> | null {
153
149
  if (
154
150
  prevState.prevQuery !== nextProps.query ||
155
151
  prevState.prevPropsEnvironment !== nextProps.environment ||
@@ -174,31 +170,8 @@ class ReactRelayQueryRenderer extends React.Component<Props, State> {
174
170
  const newState = resetQueryStateForUpdate(this.props, prevState);
175
171
  const {requestCacheKey, queryFetcher} = newState;
176
172
  if (requestCacheKey != null && requestCache[requestCacheKey] != null) {
177
- if (RelayFeatureFlags.ENABLE_QUERY_RENDERER_SET_STATE_PREVENTION) {
178
- const fetchResult = queryFetcher.getFetchResult();
179
- if (fetchResult != null) {
180
- const snapshot = fetchResult.snapshot ?? null;
181
- const error = fetchResult.error ?? null;
182
-
183
- const {requestCacheKey: prevRequestCacheKey} = prevState;
184
- if (prevRequestCacheKey != null) {
185
- delete requestCache[prevRequestCacheKey];
186
- }
187
-
188
- newState.renderProps = getRenderProps(
189
- error,
190
- snapshot,
191
- queryFetcher,
192
- prevState.retryCallbacks,
193
- );
194
- newState.snapshot = snapshot;
195
- newState.requestCacheKey = null;
196
- } else {
197
- queryFetcher.setOnDataChange(this._handleDataChange);
198
- }
199
- } else {
200
- queryFetcher.setOnDataChange(this._handleDataChange);
201
- }
173
+ // $FlowFixMe[incompatible-use]
174
+ queryFetcher.setOnDataChange(this._handleDataChange);
202
175
  }
203
176
  return newState;
204
177
  });
@@ -366,7 +339,7 @@ function getRequestCacheKey(
366
339
  function resetQueryStateForUpdate(
367
340
  props: Props,
368
341
  prevState: State,
369
- ): $Shape<State> {
342
+ ): Partial<State> {
370
343
  const {query} = props;
371
344
 
372
345
  const prevSelectionReferences =
@@ -403,7 +376,7 @@ function fetchQueryAndComputeStateFromProps(
403
376
  queryFetcher: ReactRelayQueryFetcher,
404
377
  retryCallbacks: RetryCallbacks,
405
378
  requestCacheKey: ?string,
406
- ): $Shape<State> {
379
+ ): Partial<State> {
407
380
  const {environment, query, variables, cacheConfig} = props;
408
381
  const genericEnvironment = (environment: IEnvironment);
409
382
  if (query) {
@@ -102,6 +102,7 @@ export type $FragmentRef<T> = {
102
102
  * `props.relay` and returns the props of the container.
103
103
  */
104
104
  // prettier-ignore
105
+ // $FlowFixMe[extra-type-arg] xplat redux flow type error
105
106
  export type $RelayProps<Props, RelayPropT = RelayProp> = $ObjMap<
106
107
  $Diff<Props, { relay: RelayPropT | void, ... }>,
107
108
  & (<T: { +$fragmentType: empty, ... }>( T) => T)
@@ -54,7 +54,9 @@ function buildReactRelayContainer<TBase: React$ComponentType<any>>(
54
54
 
55
55
  function forwardRef(
56
56
  props: any,
57
- ref: ((null | any) => mixed) | {current: null | any, ...},
57
+ ref:
58
+ | ((null | React$ElementRef<TBase>) => mixed)
59
+ | {-current: null | React$ElementRef<TBase>, ...},
58
60
  ) {
59
61
  const context = useContext(ReactRelayContext);
60
62
  invariant(
package/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v15.0.0
2
+ * Relay v16.0.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 v15.0.0
2
+ * Relay v16.0.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/legacy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v15.0.0
2
+ * Relay v16.0.0
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
@@ -1,14 +1,3 @@
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
- * @oncall relay
10
- */
11
-
12
1
  'use strict';
13
2
 
14
3
  function getComponentName(component) {
@@ -1,14 +1,3 @@
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
- * @oncall relay
10
- */
11
-
12
1
  'use strict';
13
2
 
14
3
  var React = require('react');
@@ -1,14 +1,3 @@
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
- * @oncall relay
10
- */
11
-
12
1
  'use strict';
13
2
 
14
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
@@ -29,40 +18,25 @@ var _require3 = require('relay-runtime'),
29
18
  createFragmentSpecResolver = _require3.createFragmentSpecResolver,
30
19
  getDataIDsFromObject = _require3.getDataIDsFromObject,
31
20
  isScalarAndEqual = _require3.isScalarAndEqual;
32
- /**
33
- * Composes a React component class, returning a new class that intercepts
34
- * props, resolving them with the provided fragments and subscribing for
35
- * updates.
36
- */
37
21
  function createContainerWithFragments(Component, fragments) {
38
22
  var _class;
39
23
  var containerName = getContainerName(Component);
40
24
  return _class = /*#__PURE__*/function (_React$Component) {
41
25
  (0, _inheritsLoose2["default"])(_class, _React$Component);
42
- // $FlowFixMe[missing-local-annot]
43
-
44
26
  function _class(props) {
45
27
  var _props$__rootIsQueryR, _this;
46
28
  _this = _React$Component.call(this, props) || this;
47
29
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "_handleFragmentDataUpdate", function () {
48
30
  var resolverFromThisUpdate = _this.state.resolver;
49
31
  _this.setState(function (updatedState) {
50
- return (
51
- // If this event belongs to the current data source, update.
52
- // Otherwise we should ignore it.
53
- resolverFromThisUpdate === updatedState.resolver ? {
54
- data: updatedState.resolver.resolve(),
55
- relayProp: getRelayProp(updatedState.relayProp.environment)
56
- } : null
57
- );
32
+ return resolverFromThisUpdate === updatedState.resolver ? {
33
+ data: updatedState.resolver.resolve(),
34
+ relayProp: getRelayProp(updatedState.relayProp.environment)
35
+ } : null;
58
36
  });
59
37
  });
60
38
  var relayContext = assertRelayContext(props.__relayContext);
61
39
  var rootIsQueryRenderer = (_props$__rootIsQueryR = props.__rootIsQueryRenderer) !== null && _props$__rootIsQueryR !== void 0 ? _props$__rootIsQueryR : false;
62
- // Do not provide a subscription/callback here.
63
- // It is possible for this render to be interrupted or aborted,
64
- // In which case the subscription would cause a leak.
65
- // We will add the subscription in componentDidMount().
66
40
  var resolver = createFragmentSpecResolver(relayContext, containerName, fragments, props, rootIsQueryRenderer);
67
41
  _this.state = {
68
42
  data: resolver.resolve(),
@@ -73,33 +47,15 @@ function createContainerWithFragments(Component, fragments) {
73
47
  };
74
48
  return _this;
75
49
  }
76
-
77
- /**
78
- * When new props are received, read data for the new props and subscribe
79
- * for updates. Props may be the same in which case previous data and
80
- * subscriptions can be reused.
81
- */
82
50
  _class.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, prevState) {
83
51
  var _nextProps$__rootIsQu;
84
- // Any props change could impact the query, so we mirror props in state.
85
- // This is an unusual pattern, but necessary for this container usecase.
86
52
  var prevProps = prevState.prevProps;
87
53
  var relayContext = assertRelayContext(nextProps.__relayContext);
88
54
  var rootIsQueryRenderer = (_nextProps$__rootIsQu = nextProps.__rootIsQueryRenderer) !== null && _nextProps$__rootIsQu !== void 0 ? _nextProps$__rootIsQu : false;
89
55
  var prevIDs = getDataIDsFromObject(fragments, prevProps);
90
56
  var nextIDs = getDataIDsFromObject(fragments, nextProps);
91
57
  var resolver = prevState.resolver;
92
-
93
- // If the environment has changed or props point to new records then
94
- // previously fetched data and any pending fetches no longer apply:
95
- // - Existing references are on the old environment.
96
- // - Existing references are based on old variables.
97
- // - Pending fetches are for the previous records.
98
58
  if (prevState.prevPropsContext.environment !== relayContext.environment || !areEqual(prevIDs, nextIDs)) {
99
- // Do not provide a subscription/callback here.
100
- // It is possible for this render to be interrupted or aborted,
101
- // In which case the subscription would cause a leak.
102
- // We will add the subscription in componentDidUpdate().
103
59
  resolver = createFragmentSpecResolver(relayContext, containerName, fragments, nextProps, rootIsQueryRenderer);
104
60
  return {
105
61
  data: resolver.resolve(),
@@ -138,12 +94,9 @@ function createContainerWithFragments(Component, fragments) {
138
94
  this.state.resolver.dispose();
139
95
  };
140
96
  _proto.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
141
- // Short-circuit if any Relay-related data has changed
142
97
  if (nextState.data !== this.state.data) {
143
98
  return true;
144
99
  }
145
- // Otherwise, for convenience short-circuit if all non-Relay props
146
- // are scalar and equal
147
100
  var keys = Object.keys(nextProps);
148
101
  for (var ii = 0; ii < keys.length; ii++) {
149
102
  var key = keys[ii];
@@ -158,17 +111,11 @@ function createContainerWithFragments(Component, fragments) {
158
111
  }
159
112
  }
160
113
  return false;
161
- }
162
-
163
- /**
164
- * Render new data for the existing props/context.
165
- */;
114
+ };
166
115
  _proto._rerenderIfStoreHasChanged = function _rerenderIfStoreHasChanged() {
167
116
  var _this$state = this.state,
168
117
  data = _this$state.data,
169
118
  resolver = _this$state.resolver;
170
- // External values could change between render and commit.
171
- // Check for this case, even though it requires an extra store read.
172
119
  var maybeNewData = resolver.resolve();
173
120
  if (data !== maybeNewData) {
174
121
  this.setState({
@@ -181,24 +128,14 @@ function createContainerWithFragments(Component, fragments) {
181
128
  data = _this$state2.data,
182
129
  resolver = _this$state2.resolver;
183
130
  var maybeNewData = resolver.resolve();
184
-
185
- // Event listeners are only safe to add during the commit phase,
186
- // So they won't leak if render is interrupted or errors.
187
131
  resolver.setCallback(this.props, this._handleFragmentDataUpdate);
188
-
189
- // External values could change between render and commit.
190
- // Check for this case, even though it requires an extra store read.
191
132
  if (data !== maybeNewData) {
192
133
  this.setState({
193
134
  data: maybeNewData
194
135
  });
195
136
  }
196
- }
197
-
198
- // $FlowFixMe[missing-local-annot]
199
- ;
137
+ };
200
138
  _proto.render = function render() {
201
- // eslint-disable-next-line no-unused-vars
202
139
  var _this$props = this.props,
203
140
  componentRef = _this$props.componentRef,
204
141
  __relayContext = _this$props.__relayContext,
@@ -217,16 +154,7 @@ function getRelayProp(environment) {
217
154
  environment: environment
218
155
  };
219
156
  }
220
-
221
- /**
222
- * Wrap the basic `createContainer()` function with logic to adapt to the
223
- * `context.relay.environment` in which it is rendered. Specifically, the
224
- * extraction of the environment-specific version of fragments in the
225
- * `fragmentSpec` is memoized once per environment, rather than once per
226
- * instance of the container constructed/rendered.
227
- */
228
157
  function createContainer(Component, fragmentSpec) {
229
- // $FlowFixMe[incompatible-return]
230
158
  return buildReactRelayContainer(Component, fragmentSpec, createContainerWithFragments);
231
159
  }
232
160
  module.exports = {
@@ -1,14 +1,3 @@
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
- * @oncall relay
10
- */
11
-
12
1
  'use strict';
13
2
 
14
3
  var ReactRelayContext = require('./ReactRelayContext');
@@ -1,14 +1,3 @@
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
- * @oncall relay
10
- */
11
-
12
1
  'use strict';
13
2
 
14
3
  var ReactRelayContext = require('./ReactRelayContext');
@@ -51,9 +40,6 @@ function ReactRelayLocalQueryRenderer(props) {
51
40
  environment: environment
52
41
  };
53
42
  }, [environment]);
54
-
55
- // Use a ref to prevent rendering twice when data changes
56
- // because of props change
57
43
  var dataRef = useRef(null);
58
44
  var _useState = useState(null),
59
45
  forceUpdate = _useState[1];
@@ -62,9 +48,6 @@ function ReactRelayLocalQueryRenderer(props) {
62
48
  environment.check(operation);
63
49
  var res = environment.lookup(operation.fragment);
64
50
  dataRef.current = res.data;
65
-
66
- // Run effects here so that the data can be retained
67
- // and subscribed before the component commits
68
51
  var retainDisposable = environment.retain(operation);
69
52
  var subscribeDisposable = environment.subscribe(res, function (newSnapshot) {
70
53
  dataRef.current = newSnapshot.data;