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,49 +1,30 @@
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
- * @emails oncall+relay
9
- * @format
10
- */
11
1
  'use strict';
12
2
 
13
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
-
15
4
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
-
17
5
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
18
-
19
6
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
20
-
21
7
  var _require = require('../QueryResource'),
22
- getQueryResourceForEnvironment = _require.getQueryResourceForEnvironment;
23
-
8
+ getQueryResourceForEnvironment = _require.getQueryResourceForEnvironment;
24
9
  var useRelayEnvironment = require('../useRelayEnvironment');
25
-
26
10
  var invariant = require('invariant');
27
-
28
11
  var _require2 = require('react'),
29
- useDebugValue = _require2.useDebugValue,
30
- useEffect = _require2.useEffect,
31
- useMemo = _require2.useMemo,
32
- useRef = _require2.useRef,
33
- useState = _require2.useState;
34
-
12
+ useDebugValue = _require2.useDebugValue,
13
+ useEffect = _require2.useEffect,
14
+ useMemo = _require2.useMemo,
15
+ useRef = _require2.useRef,
16
+ useState = _require2.useState;
35
17
  var _require3 = require('relay-runtime'),
36
- fetchQueryInternal = _require3.__internal.fetchQuery,
37
- areEqualSelectors = _require3.areEqualSelectors,
38
- createOperationDescriptor = _require3.createOperationDescriptor,
39
- getPendingOperationsForFragment = _require3.getPendingOperationsForFragment,
40
- getSelector = _require3.getSelector,
41
- getVariablesFromFragment = _require3.getVariablesFromFragment,
42
- handlePotentialSnapshotErrors = _require3.handlePotentialSnapshotErrors,
43
- recycleNodesInto = _require3.recycleNodesInto;
44
-
18
+ fetchQueryInternal = _require3.__internal.fetchQuery,
19
+ RelayFeatureFlags = _require3.RelayFeatureFlags,
20
+ areEqualSelectors = _require3.areEqualSelectors,
21
+ createOperationDescriptor = _require3.createOperationDescriptor,
22
+ getPendingOperationsForFragment = _require3.getPendingOperationsForFragment,
23
+ getSelector = _require3.getSelector,
24
+ getVariablesFromFragment = _require3.getVariablesFromFragment,
25
+ handlePotentialSnapshotErrors = _require3.handlePotentialSnapshotErrors,
26
+ recycleNodesInto = _require3.recycleNodesInto;
45
27
  var warning = require("fbjs/lib/warning");
46
-
47
28
  function isMissingData(state) {
48
29
  if (state.kind === 'bailout') {
49
30
  return false;
@@ -55,32 +36,24 @@ function isMissingData(state) {
55
36
  });
56
37
  }
57
38
  }
58
-
59
39
  function getMissingClientEdges(state) {
60
40
  if (state.kind === 'bailout') {
61
41
  return null;
62
42
  } else if (state.kind === 'singular') {
63
43
  var _state$snapshot$missi;
64
-
65
44
  return (_state$snapshot$missi = state.snapshot.missingClientEdges) !== null && _state$snapshot$missi !== void 0 ? _state$snapshot$missi : null;
66
45
  } else {
67
46
  var edges = null;
68
-
69
47
  var _iterator = (0, _createForOfIteratorHelper2["default"])(state.snapshots),
70
- _step;
71
-
48
+ _step;
72
49
  try {
73
50
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
74
51
  var snapshot = _step.value;
75
-
76
52
  if (snapshot.missingClientEdges) {
77
53
  var _edges;
78
-
79
54
  edges = (_edges = edges) !== null && _edges !== void 0 ? _edges : [];
80
-
81
55
  var _iterator2 = (0, _createForOfIteratorHelper2["default"])(snapshot.missingClientEdges),
82
- _step2;
83
-
56
+ _step2;
84
57
  try {
85
58
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
86
59
  var edge = _step2.value;
@@ -98,36 +71,27 @@ function getMissingClientEdges(state) {
98
71
  } finally {
99
72
  _iterator.f();
100
73
  }
101
-
102
74
  return edges;
103
75
  }
104
76
  }
105
-
106
77
  function getSuspendingLiveResolver(state) {
107
78
  if (state.kind === 'bailout') {
108
79
  return null;
109
80
  } else if (state.kind === 'singular') {
110
81
  var _state$snapshot$missi2;
111
-
112
82
  return (_state$snapshot$missi2 = state.snapshot.missingLiveResolverFields) !== null && _state$snapshot$missi2 !== void 0 ? _state$snapshot$missi2 : null;
113
83
  } else {
114
84
  var missingFields = null;
115
-
116
85
  var _iterator3 = (0, _createForOfIteratorHelper2["default"])(state.snapshots),
117
- _step3;
118
-
86
+ _step3;
119
87
  try {
120
88
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
121
89
  var snapshot = _step3.value;
122
-
123
90
  if (snapshot.missingLiveResolverFields) {
124
91
  var _missingFields;
125
-
126
92
  missingFields = (_missingFields = missingFields) !== null && _missingFields !== void 0 ? _missingFields : [];
127
-
128
93
  var _iterator4 = (0, _createForOfIteratorHelper2["default"])(snapshot.missingLiveResolverFields),
129
- _step4;
130
-
94
+ _step4;
131
95
  try {
132
96
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
133
97
  var edge = _step4.value;
@@ -145,18 +109,15 @@ function getSuspendingLiveResolver(state) {
145
109
  } finally {
146
110
  _iterator3.f();
147
111
  }
148
-
149
112
  return missingFields;
150
113
  }
151
114
  }
152
-
153
115
  function handlePotentialSnapshotErrorsForState(environment, state) {
154
116
  if (state.kind === 'singular') {
155
117
  handlePotentialSnapshotErrors(environment, state.snapshot.missingRequiredFields, state.snapshot.relayResolverErrors);
156
118
  } else if (state.kind === 'plural') {
157
119
  var _iterator5 = (0, _createForOfIteratorHelper2["default"])(state.snapshots),
158
- _step5;
159
-
120
+ _step5;
160
121
  try {
161
122
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
162
123
  var snapshot = _step5.value;
@@ -169,26 +130,14 @@ function handlePotentialSnapshotErrorsForState(environment, state) {
169
130
  }
170
131
  }
171
132
  }
172
- /**
173
- * Check for updates to the store that occurred concurrently with rendering the given `state` value,
174
- * returning a new (updated) state if there were updates or null if there were no changes.
175
- */
176
-
177
-
178
133
  function handleMissedUpdates(environment, state) {
179
134
  if (state.kind === 'bailout') {
180
135
  return null;
181
- } // FIXME this is invalid if we've just switched environments.
182
-
183
-
136
+ }
184
137
  var currentEpoch = environment.getStore().getEpoch();
185
-
186
138
  if (currentEpoch === state.epoch) {
187
139
  return null;
188
- } // The store has updated since we rendered (without us being subscribed yet),
189
- // so check for any updates to the data we're rendering:
190
-
191
-
140
+ }
192
141
  if (state.kind === 'singular') {
193
142
  var currentSnapshot = environment.lookup(state.snapshot.selector);
194
143
  var updatedData = recycleNodesInto(state.snapshot.data, currentSnapshot.data);
@@ -210,14 +159,10 @@ function handleMissedUpdates(environment, state) {
210
159
  } else {
211
160
  var didMissUpdates = false;
212
161
  var currentSnapshots = [];
213
-
214
162
  for (var index = 0; index < state.snapshots.length; index++) {
215
163
  var snapshot = state.snapshots[index];
216
-
217
164
  var _currentSnapshot = environment.lookup(snapshot.selector);
218
-
219
165
  var _updatedData = recycleNodesInto(snapshot.data, _currentSnapshot.data);
220
-
221
166
  var _updatedCurrentSnapshot = {
222
167
  data: _updatedData,
223
168
  isMissingData: _currentSnapshot.isMissingData,
@@ -228,14 +173,11 @@ function handleMissedUpdates(environment, state) {
228
173
  missingRequiredFields: _currentSnapshot.missingRequiredFields,
229
174
  relayResolverErrors: _currentSnapshot.relayResolverErrors
230
175
  };
231
-
232
176
  if (_updatedData !== snapshot.data) {
233
177
  didMissUpdates = true;
234
178
  }
235
-
236
179
  currentSnapshots.push(_updatedCurrentSnapshot);
237
180
  }
238
-
239
181
  !(currentSnapshots.length === state.snapshots.length) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Expected same number of snapshots') : invariant(false) : void 0;
240
182
  return [didMissUpdates, {
241
183
  kind: 'plural',
@@ -244,35 +186,35 @@ function handleMissedUpdates(environment, state) {
244
186
  }];
245
187
  }
246
188
  }
247
-
248
189
  function handleMissingClientEdge(environment, parentFragmentNode, parentFragmentRef, missingClientEdgeRequestInfo, queryOptions) {
249
190
  var originalVariables = getVariablesFromFragment(parentFragmentNode, parentFragmentRef);
250
191
  var variables = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, originalVariables), {}, {
251
- id: missingClientEdgeRequestInfo.clientEdgeDestinationID // TODO should be a reserved name
252
-
192
+ id: missingClientEdgeRequestInfo.clientEdgeDestinationID
253
193
  });
254
- var queryOperationDescriptor = createOperationDescriptor(missingClientEdgeRequestInfo.request, variables, queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.networkCacheConfig); // This may suspend. We don't need to do anything with the results; all we're
255
- // doing here is started the query if needed and retaining and releasing it
256
- // according to the component mount/suspense cycle; QueryResource
257
- // already handles this by itself.
258
-
194
+ var queryOperationDescriptor = createOperationDescriptor(missingClientEdgeRequestInfo.request, variables, queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.networkCacheConfig);
259
195
  var QueryResource = getQueryResourceForEnvironment(environment);
260
196
  return QueryResource.prepare(queryOperationDescriptor, fetchQueryInternal(environment, queryOperationDescriptor), queryOptions === null || queryOptions === void 0 ? void 0 : queryOptions.fetchPolicy);
261
197
  }
262
-
263
198
  function subscribeToSnapshot(environment, state, setState) {
264
199
  if (state.kind === 'bailout') {
265
200
  return function () {};
266
201
  } else if (state.kind === 'singular') {
267
202
  var disposable = environment.subscribe(state.snapshot, function (latestSnapshot) {
268
203
  setState(function (prevState) {
269
- // In theory a setState from a subscription could be batched together
270
- // with a setState to change the fragment selector. Guard against this
271
- // by bailing out of the state update if the selector has changed.
272
204
  if (prevState.kind !== 'singular' || prevState.snapshot.selector !== latestSnapshot.selector) {
273
- return prevState;
205
+ var updates = handleMissedUpdates(environment, prevState);
206
+ if (updates != null) {
207
+ var dataChanged = updates[0],
208
+ nextState = updates[1];
209
+ environment.__log({
210
+ name: 'useFragment.subscription.missedUpdates',
211
+ hasDataChanges: dataChanged
212
+ });
213
+ return dataChanged ? nextState : prevState;
214
+ } else {
215
+ return prevState;
216
+ }
274
217
  }
275
-
276
218
  return {
277
219
  kind: 'singular',
278
220
  snapshot: latestSnapshot,
@@ -288,14 +230,20 @@ function subscribeToSnapshot(environment, state, setState) {
288
230
  return environment.subscribe(snapshot, function (latestSnapshot) {
289
231
  setState(function (prevState) {
290
232
  var _prevState$snapshots$;
291
-
292
- // In theory a setState from a subscription could be batched together
293
- // with a setState to change the fragment selector. Guard against this
294
- // by bailing out of the state update if the selector has changed.
295
233
  if (prevState.kind !== 'plural' || ((_prevState$snapshots$ = prevState.snapshots[index]) === null || _prevState$snapshots$ === void 0 ? void 0 : _prevState$snapshots$.selector) !== latestSnapshot.selector) {
296
- return prevState;
234
+ var updates = handleMissedUpdates(environment, prevState);
235
+ if (updates != null) {
236
+ var dataChanged = updates[0],
237
+ nextState = updates[1];
238
+ environment.__log({
239
+ name: 'useFragment.subscription.missedUpdates',
240
+ hasDataChanges: dataChanged
241
+ });
242
+ return dataChanged ? nextState : prevState;
243
+ } else {
244
+ return prevState;
245
+ }
297
246
  }
298
-
299
247
  var updated = (0, _toConsumableArray2["default"])(prevState.snapshots);
300
248
  updated[index] = latestSnapshot;
301
249
  return {
@@ -308,8 +256,7 @@ function subscribeToSnapshot(environment, state, setState) {
308
256
  });
309
257
  return function () {
310
258
  var _iterator6 = (0, _createForOfIteratorHelper2["default"])(disposables),
311
- _step6;
312
-
259
+ _step6;
313
260
  try {
314
261
  for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
315
262
  var d = _step6.value;
@@ -323,15 +270,12 @@ function subscribeToSnapshot(environment, state, setState) {
323
270
  };
324
271
  }
325
272
  }
326
-
327
273
  function getFragmentState(environment, fragmentSelector) {
328
274
  if (fragmentSelector == null) {
329
275
  return {
330
276
  kind: 'bailout'
331
277
  };
332
278
  } else if (fragmentSelector.kind === 'PluralReaderSelector') {
333
- // Note that if fragmentRef is an empty array, fragmentSelector will be null so we'll hit the above case.
334
- // Null is returned by getSelector if fragmentRef has no non-null items.
335
279
  return {
336
280
  kind: 'plural',
337
281
  snapshots: fragmentSelector.selectors.map(function (s) {
@@ -346,94 +290,57 @@ function getFragmentState(environment, fragmentSelector) {
346
290
  epoch: environment.getStore().getEpoch()
347
291
  };
348
292
  }
349
- } // fragmentNode cannot change during the lifetime of the component, though fragmentRef may change.
350
-
351
-
352
- function useFragmentInternal_REACT_CACHE(fragmentNode, fragmentRef, hookDisplayName, queryOptions, fragmentKey) {
293
+ }
294
+ function useFragmentInternal_REACT_CACHE(fragmentNode, fragmentRef, hookDisplayName, queryOptions) {
353
295
  var _fragmentNode$metadat, _fragmentNode$metadat2;
354
-
355
296
  var fragmentSelector = useMemo(function () {
356
297
  return getSelector(fragmentNode, fragmentRef);
357
298
  }, [fragmentNode, fragmentRef]);
358
299
  var isPlural = (fragmentNode === null || fragmentNode === void 0 ? void 0 : (_fragmentNode$metadat = fragmentNode.metadata) === null || _fragmentNode$metadat === void 0 ? void 0 : _fragmentNode$metadat.plural) === true;
359
-
360
300
  if (isPlural) {
361
- !(fragmentRef == null || Array.isArray(fragmentRef)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected fragment pointer%s for fragment `%s` to be ' + 'an array, instead got `%s`. Remove `@relay(plural: true)` ' + 'from fragment `%s` to allow the prop to be an object.', fragmentKey != null ? " for key `".concat(fragmentKey, "`") : '', fragmentNode.name, typeof fragmentRef, fragmentNode.name) : invariant(false) : void 0;
301
+ !(fragmentRef == null || Array.isArray(fragmentRef)) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected fragment pointer%s for fragment `%s` to be ' + 'an array, instead got `%s`. Remove `@relay(plural: true)` ' + 'from fragment `%s` to allow the prop to be an object.', fragmentNode.name, typeof fragmentRef, fragmentNode.name) : invariant(false) : void 0;
362
302
  } else {
363
- !!Array.isArray(fragmentRef) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected fragment pointer%s for fragment `%s` not to be ' + 'an array, instead got `%s`. Add `@relay(plural: true)` ' + 'to fragment `%s` to allow the prop to be an array.', fragmentKey != null ? " for key `".concat(fragmentKey, "`") : '', fragmentNode.name, typeof fragmentRef, fragmentNode.name) : invariant(false) : void 0;
303
+ !!Array.isArray(fragmentRef) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected fragment pointer%s for fragment `%s` not to be ' + 'an array, instead got `%s`. Add `@relay(plural: true)` ' + 'to fragment `%s` to allow the prop to be an array.', fragmentNode.name, typeof fragmentRef, fragmentNode.name) : invariant(false) : void 0;
364
304
  }
365
-
366
- !(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'In this case, pass `null` if the conditions for evaluating the ' + 'fragment are not met (e.g. if the `@include(if)` value is false.)', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, fragmentKey == null ? 'a fragment reference' : "the `".concat(fragmentKey, "`"), hookDisplayName) : invariant(false) : void 0;
305
+ !(fragmentRef == null || isPlural && Array.isArray(fragmentRef) && fragmentRef.length === 0 || fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'Relay: Expected to receive an object where `...%s` was spread, ' + 'but the fragment reference was not found`. This is most ' + 'likely the result of:\n' + "- Forgetting to spread `%s` in `%s`'s parent's fragment.\n" + '- Conditionally fetching `%s` but unconditionally passing %s prop ' + 'to `%s`. If the parent fragment only fetches the fragment conditionally ' + '- with e.g. `@include`, `@skip`, or inside a `... on SomeType { }` ' + 'spread - then the fragment reference will not exist. ' + 'In this case, pass `null` if the conditions for evaluating the ' + 'fragment are not met (e.g. if the `@include(if)` value is false.)', fragmentNode.name, fragmentNode.name, hookDisplayName, fragmentNode.name, hookDisplayName) : invariant(false) : void 0;
367
306
  var environment = useRelayEnvironment();
368
-
369
307
  var _useState = useState(function () {
370
- return getFragmentState(environment, fragmentSelector);
371
- }),
372
- _state = _useState[0],
373
- setState = _useState[1];
374
-
375
- var state = _state; // This copy of the state we only update when something requires us to
376
- // unsubscribe and re-subscribe, namely a changed environment or
377
- // fragment selector.
378
-
308
+ return getFragmentState(environment, fragmentSelector);
309
+ }),
310
+ _state = _useState[0],
311
+ setState = _useState[1];
312
+ var state = _state;
379
313
  var _useState2 = useState(state),
380
- _subscribedState = _useState2[0],
381
- setSubscribedState = _useState2[1]; // FIXME since this is used as an effect dependency, it needs to be memoized.
382
-
383
-
314
+ _subscribedState = _useState2[0],
315
+ setSubscribedState = _useState2[1];
384
316
  var subscribedState = _subscribedState;
385
-
386
317
  var _useState3 = useState(fragmentSelector),
387
- previousFragmentSelector = _useState3[0],
388
- setPreviousFragmentSelector = _useState3[1];
389
-
318
+ previousFragmentSelector = _useState3[0],
319
+ setPreviousFragmentSelector = _useState3[1];
390
320
  var _useState4 = useState(environment),
391
- previousEnvironment = _useState4[0],
392
- setPreviousEnvironment = _useState4[1];
393
-
321
+ previousEnvironment = _useState4[0],
322
+ setPreviousEnvironment = _useState4[1];
394
323
  if (!areEqualSelectors(fragmentSelector, previousFragmentSelector) || environment !== previousEnvironment) {
395
- // Enqueue setState to record the new selector and state
396
324
  setPreviousFragmentSelector(fragmentSelector);
397
325
  setPreviousEnvironment(environment);
398
326
  var newState = getFragmentState(environment, fragmentSelector);
399
327
  setState(newState);
400
- setSubscribedState(newState); // This causes us to form a new subscription
401
- // But render with the latest state w/o waiting for the setState. Otherwise
402
- // the component would render the wrong information temporarily (including
403
- // possibly incorrectly triggering some warnings below).
404
-
328
+ setSubscribedState(newState);
405
329
  state = newState;
406
330
  subscribedState = newState;
407
- } // The purpose of this is to detect whether we have ever committed, because we
408
- // don't suspend on store updates, only when the component either is first trying
409
- // to mount or when the our selector changes. The selector change in particular is
410
- // how we suspend for pagination and refetech. Also, fragment selector can be null
411
- // or undefined, so we use false as a special value to distinguish from all fragment
412
- // selectors; false means that the component hasn't mounted yet.
413
-
414
-
331
+ }
415
332
  var committedFragmentSelectorRef = useRef(false);
416
333
  useEffect(function () {
417
334
  committedFragmentSelectorRef.current = fragmentSelector;
418
- }, [fragmentSelector]); // Handle the queries for any missing client edges; this may suspend.
419
- // FIXME handle client edges in parallel.
420
-
335
+ }, [fragmentSelector]);
421
336
  if (((_fragmentNode$metadat2 = fragmentNode.metadata) === null || _fragmentNode$metadat2 === void 0 ? void 0 : _fragmentNode$metadat2.hasClientEdges) === true) {
422
- // The fragment is validated to be static (in useFragment) and hasClientEdges is
423
- // a static (constant) property of the fragment. In practice, this effect will
424
- // always or never run for a given invocation of this hook.
425
- // eslint-disable-next-line react-hooks/rules-of-hooks
426
337
  var clientEdgeQueries = useMemo(function () {
427
- var missingClientEdges = getMissingClientEdges(state); // eslint-disable-next-line no-shadow
428
-
338
+ var missingClientEdges = getMissingClientEdges(state);
429
339
  var clientEdgeQueries;
430
-
431
340
  if (missingClientEdges !== null && missingClientEdges !== void 0 && missingClientEdges.length) {
432
341
  clientEdgeQueries = [];
433
-
434
342
  var _iterator7 = (0, _createForOfIteratorHelper2["default"])(missingClientEdges),
435
- _step7;
436
-
343
+ _step7;
437
344
  try {
438
345
  for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
439
346
  var edge = _step7.value;
@@ -445,20 +352,14 @@ function useFragmentInternal_REACT_CACHE(fragmentNode, fragmentRef, hookDisplayN
445
352
  _iterator7.f();
446
353
  }
447
354
  }
448
-
449
355
  return clientEdgeQueries;
450
- }, [state, environment, fragmentNode, fragmentRef, queryOptions]); // See above note
451
- // eslint-disable-next-line react-hooks/rules-of-hooks
452
-
356
+ }, [state, environment, fragmentNode, fragmentRef, queryOptions]);
453
357
  useEffect(function () {
454
358
  var QueryResource = getQueryResourceForEnvironment(environment);
455
-
456
359
  if (clientEdgeQueries !== null && clientEdgeQueries !== void 0 && clientEdgeQueries.length) {
457
360
  var disposables = [];
458
-
459
361
  var _iterator8 = (0, _createForOfIteratorHelper2["default"])(clientEdgeQueries),
460
- _step8;
461
-
362
+ _step8;
462
363
  try {
463
364
  for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
464
365
  var query = _step8.value;
@@ -469,11 +370,9 @@ function useFragmentInternal_REACT_CACHE(fragmentNode, fragmentRef, hookDisplayN
469
370
  } finally {
470
371
  _iterator8.f();
471
372
  }
472
-
473
373
  return function () {
474
374
  var _iterator9 = (0, _createForOfIteratorHelper2["default"])(disposables),
475
- _step9;
476
-
375
+ _step9;
477
376
  try {
478
377
  for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
479
378
  var disposable = _step9.value;
@@ -488,77 +387,42 @@ function useFragmentInternal_REACT_CACHE(fragmentNode, fragmentRef, hookDisplayN
488
387
  }
489
388
  }, [environment, clientEdgeQueries]);
490
389
  }
491
-
492
390
  if (isMissingData(state)) {
493
- // Suspend if a Live Resolver within this fragment is in a suspended state:
494
391
  var suspendingLiveResolvers = getSuspendingLiveResolver(state);
495
-
496
392
  if (suspendingLiveResolvers != null && suspendingLiveResolvers.length > 0) {
497
393
  throw Promise.all(suspendingLiveResolvers.map(function (_ref) {
498
394
  var liveStateID = _ref.liveStateID;
499
- // $FlowFixMe[prop-missing] This is expected to be a LiveResolverStore
500
395
  return environment.getStore().getLiveResolverPromise(liveStateID);
501
396
  }));
502
- } // Suspend if an active operation bears on this fragment, either the
503
- // fragment's owner or some other mutation etc. that could affect it.
504
- // We only suspend when the component is first trying to mount or changing
505
- // selectors, not if data becomes missing later:
506
-
507
-
397
+ }
508
398
  if (!committedFragmentSelectorRef.current || !areEqualSelectors(committedFragmentSelectorRef.current, fragmentSelector)) {
509
399
  !(fragmentSelector != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'refinement, see invariants above') : invariant(false) : void 0;
510
400
  var fragmentOwner = fragmentSelector.kind === 'PluralReaderSelector' ? fragmentSelector.selectors[0].owner : fragmentSelector.owner;
511
401
  var pendingOperationsResult = getPendingOperationsForFragment(environment, fragmentNode, fragmentOwner);
512
-
513
402
  if (pendingOperationsResult) {
514
403
  throw pendingOperationsResult.promise;
515
404
  }
516
- } // Report required fields only if we're not suspending, since that means
517
- // they're missing even though we are out of options for possibly fetching them:
518
-
519
-
520
- handlePotentialSnapshotErrorsForState(environment, state);
405
+ }
521
406
  }
522
-
407
+ handlePotentialSnapshotErrorsForState(environment, state);
523
408
  useEffect(function () {
524
- // Check for updates since the state was rendered
525
409
  var currentState = subscribedState;
526
410
  var updates = handleMissedUpdates(environment, subscribedState);
527
-
528
411
  if (updates !== null) {
529
412
  var didMissUpdates = updates[0],
530
- updatedState = updates[1]; // TODO: didMissUpdates only checks for changes to snapshot data, but it's possible
531
- // that other snapshot properties may have changed that should also trigger a re-render,
532
- // such as changed missing resolver fields, missing client edges, etc.
533
- // A potential alternative is for handleMissedUpdates() to recycle the entire state
534
- // value, and return the new (recycled) state only if there was some change. In that
535
- // case the code would always setState if something in the snapshot changed, in addition
536
- // to using the latest snapshot to subscribe.
537
-
413
+ updatedState = updates[1];
538
414
  if (didMissUpdates) {
539
415
  setState(updatedState);
540
416
  }
541
-
542
417
  currentState = updatedState;
543
418
  }
544
-
545
419
  return subscribeToSnapshot(environment, currentState, setState);
546
420
  }, [environment, subscribedState]);
547
421
  var data;
548
-
549
422
  if (isPlural) {
550
- // Plural fragments require allocating an array of the snasphot data values,
551
- // which has to be memoized to avoid triggering downstream re-renders.
552
- //
553
- // Note that isPlural is a constant property of the fragment and does not change
554
- // for a particular useFragment invocation site
555
- var fragmentRefIsNullish = fragmentRef == null; // for less sensitive memoization
556
- // eslint-disable-next-line react-hooks/rules-of-hooks
557
-
423
+ var fragmentRefIsNullish = fragmentRef == null;
558
424
  data = useMemo(function () {
559
425
  if (state.kind === 'bailout') {
560
- // Bailout state can happen if the fragmentRef is a plural array that is empty or has no
561
- // non-null entries. In that case, the compatible behavior is to return [] instead of null.
562
426
  return fragmentRefIsNullish ? null : [];
563
427
  } else {
564
428
  !(state.kind === 'plural') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Expected state to be plural because fragment is plural') : invariant(false) : void 0;
@@ -568,31 +432,24 @@ function useFragmentInternal_REACT_CACHE(fragmentNode, fragmentRef, hookDisplayN
568
432
  }
569
433
  }, [state, fragmentRefIsNullish]);
570
434
  } else if (state.kind === 'bailout') {
571
- // This case doesn't allocate a new object so it doesn't have to be memoized
572
435
  data = null;
573
436
  } else {
574
- // This case doesn't allocate a new object so it doesn't have to be memoized
575
437
  !(state.kind === 'singular') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Expected state to be singular because fragment is singular') : invariant(false) : void 0;
576
438
  data = state.snapshot.data;
577
439
  }
578
-
579
- if (process.env.NODE_ENV !== "production") {
440
+ if (RelayFeatureFlags.LOG_MISSING_RECORDS_IN_PROD || process.env.NODE_ENV !== "production") {
580
441
  if (fragmentRef != null && (data === undefined || Array.isArray(data) && data.length > 0 && data.every(function (d) {
581
442
  return d === undefined;
582
443
  }))) {
583
444
  process.env.NODE_ENV !== "production" ? warning(false, 'Relay: Expected to have been able to read non-null data for ' + 'fragment `%s` declared in ' + '`%s`, since fragment reference was non-null. ' + "Make sure that that `%s`'s parent isn't " + 'holding on to and/or passing a fragment reference for data that ' + 'has been deleted.', fragmentNode.name, hookDisplayName, hookDisplayName) : void 0;
584
445
  }
585
446
  }
586
-
587
447
  if (process.env.NODE_ENV !== "production") {
588
- // eslint-disable-next-line react-hooks/rules-of-hooks
589
448
  useDebugValue({
590
449
  fragment: fragmentNode.name,
591
450
  data: data
592
451
  });
593
452
  }
594
-
595
453
  return data;
596
454
  }
597
-
598
455
  module.exports = useFragmentInternal_REACT_CACHE;
@@ -1,50 +1,26 @@
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
- * @emails oncall+relay
8
- *
9
- * @format
10
- */
11
1
  'use strict';
12
2
 
13
3
  var _require = require('../loadQuery'),
14
- useTrackLoadQueryInRender = _require.useTrackLoadQueryInRender;
15
-
4
+ useTrackLoadQueryInRender = _require.useTrackLoadQueryInRender;
16
5
  var useStaticFragmentNodeWarning = require('../useStaticFragmentNodeWarning');
17
-
18
6
  var useFragmentInternal = require('./useFragmentInternal_REACT_CACHE');
19
-
20
7
  var _require2 = require('react'),
21
- useDebugValue = _require2.useDebugValue;
22
-
8
+ useDebugValue = _require2.useDebugValue;
23
9
  var _require3 = require('relay-runtime'),
24
- getFragment = _require3.getFragment;
25
-
10
+ getFragment = _require3.getFragment;
26
11
  function useFragment(fragment, key) {
27
- // We need to use this hook in order to be able to track if
28
- // loadQuery was called during render
29
12
  useTrackLoadQueryInRender();
30
13
  var fragmentNode = getFragment(fragment);
31
-
32
14
  if (process.env.NODE_ENV !== "production") {
33
- // eslint-disable-next-line react-hooks/rules-of-hooks
34
15
  useStaticFragmentNodeWarning(fragmentNode, 'first argument of useFragment()');
35
16
  }
36
-
37
17
  var data = useFragmentInternal(fragmentNode, key, 'useFragment()');
38
-
39
18
  if (process.env.NODE_ENV !== "production") {
40
- // eslint-disable-next-line react-hooks/rules-of-hooks
41
19
  useDebugValue({
42
20
  fragment: fragmentNode.name,
43
21
  data: data
44
22
  });
45
23
  }
46
-
47
24
  return data;
48
25
  }
49
-
50
26
  module.exports = useFragment;