react-relay 14.1.0 → 15.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) 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 +19 -5
  9. package/ReactRelayQueryRenderer.js.flow +32 -1
  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 +1 -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 +7 -5
  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 +2 -2
  47. package/lib/ReactRelayContext.js +3 -3
  48. package/lib/ReactRelayFragmentContainer.js +39 -66
  49. package/lib/ReactRelayFragmentMockRenderer.js +2 -3
  50. package/lib/ReactRelayLocalQueryRenderer.js +18 -30
  51. package/lib/ReactRelayPaginationContainer.js +66 -159
  52. package/lib/ReactRelayQueryFetcher.js +48 -74
  53. package/lib/ReactRelayQueryRenderer.js +62 -82
  54. package/lib/ReactRelayQueryRendererContext.js +2 -1
  55. package/lib/ReactRelayRefetchContainer.js +52 -99
  56. package/lib/ReactRelayTestMocker.js +32 -66
  57. package/lib/ReactRelayTypes.js +2 -0
  58. package/lib/RelayContext.js +4 -6
  59. package/lib/assertFragmentMap.js +3 -4
  60. package/lib/buildReactRelayContainer.js +10 -25
  61. package/lib/getRootVariablesForFragments.js +5 -8
  62. package/lib/hooks.js +5 -17
  63. package/lib/index.js +5 -24
  64. package/lib/isRelayEnvironment.js +5 -3
  65. package/lib/jest-react/enqueueTask.js +5 -9
  66. package/lib/jest-react/index.js +0 -1
  67. package/lib/jest-react/internalAct.js +9 -20
  68. package/lib/legacy.js +2 -7
  69. package/lib/multi-actor/ActorChange.js +2 -5
  70. package/lib/multi-actor/index.js +2 -1
  71. package/lib/multi-actor/useRelayActorEnvironment.js +4 -7
  72. package/lib/relay-hooks/EntryPointContainer.react.js +9 -14
  73. package/lib/relay-hooks/EntryPointTypes.flow.js +5 -2
  74. package/lib/relay-hooks/FragmentResource.js +102 -196
  75. package/lib/relay-hooks/HooksImplementation.js +2 -5
  76. package/lib/relay-hooks/InternalLogger.js +2 -2
  77. package/lib/relay-hooks/LRUCache.js +2 -19
  78. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +33 -53
  79. package/lib/relay-hooks/MatchContainer.js +14 -22
  80. package/lib/relay-hooks/ProfilerContext.js +3 -2
  81. package/lib/relay-hooks/QueryResource.js +30 -99
  82. package/lib/relay-hooks/RelayEnvironmentProvider.js +5 -8
  83. package/lib/relay-hooks/SuspenseResource.js +8 -31
  84. package/lib/relay-hooks/loadEntryPoint.js +19 -31
  85. package/lib/relay-hooks/loadQuery.js +41 -77
  86. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +10 -35
  87. package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +9 -14
  88. package/lib/relay-hooks/react-cache/RelayReactCache.js +7 -11
  89. package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +24 -78
  90. package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +23 -56
  91. package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +65 -143
  92. package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +5 -14
  93. package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +17 -23
  94. package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +73 -74
  95. package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +24 -38
  96. package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +60 -102
  97. package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +7 -15
  98. package/lib/relay-hooks/useBlockingPaginationFragment.js +71 -92
  99. package/lib/relay-hooks/useClientQuery.js +3 -6
  100. package/lib/relay-hooks/useEntryPointLoader.js +17 -36
  101. package/lib/relay-hooks/useFetchTrackingRef.js +10 -11
  102. package/lib/relay-hooks/useFragment.js +8 -18
  103. package/lib/relay-hooks/useFragmentNode.js +20 -31
  104. package/lib/relay-hooks/useIsMountedRef.js +4 -5
  105. package/lib/relay-hooks/useIsOperationNodeActive.js +8 -20
  106. package/lib/relay-hooks/useIsParentQueryActive.js +3 -6
  107. package/lib/relay-hooks/useLazyLoadQuery.js +6 -9
  108. package/lib/relay-hooks/useLazyLoadQueryNode.js +23 -33
  109. package/lib/relay-hooks/useLoadMoreFunction.js +45 -76
  110. package/lib/relay-hooks/useMemoOperationDescriptor.js +6 -14
  111. package/lib/relay-hooks/useMemoVariables.js +15 -33
  112. package/lib/relay-hooks/useMutation.js +8 -25
  113. package/lib/relay-hooks/usePaginationFragment.js +61 -76
  114. package/lib/relay-hooks/usePreloadedQuery.js +12 -29
  115. package/lib/relay-hooks/useQueryLoader.js +23 -47
  116. package/lib/relay-hooks/useRefetchableFragment.js +8 -18
  117. package/lib/relay-hooks/useRefetchableFragmentNode.js +64 -107
  118. package/lib/relay-hooks/useRelayEnvironment.js +4 -7
  119. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +4 -7
  120. package/lib/relay-hooks/useSubscribeToInvalidationState.js +8 -8
  121. package/lib/relay-hooks/useSubscription.js +5 -9
  122. package/lib/relay-hooks/useUnsafeRef_DEPRECATED.js +29 -0
  123. package/multi-actor/ActorChange.js.flow +1 -1
  124. package/multi-actor/index.js.flow +1 -1
  125. package/multi-actor/useRelayActorEnvironment.js.flow +2 -2
  126. package/package.json +2 -2
  127. package/react-relay-hooks.js +2 -2
  128. package/react-relay-hooks.min.js +2 -2
  129. package/react-relay-legacy.js +2 -2
  130. package/react-relay-legacy.min.js +2 -2
  131. package/react-relay.js +2 -2
  132. package/react-relay.min.js +2 -2
  133. package/relay-hooks/EntryPointContainer.react.js.flow +1 -1
  134. package/relay-hooks/EntryPointTypes.flow.js.flow +7 -5
  135. package/relay-hooks/FragmentResource.js.flow +34 -8
  136. package/relay-hooks/HooksImplementation.js.flow +1 -1
  137. package/relay-hooks/InternalLogger.js.flow +1 -1
  138. package/relay-hooks/LRUCache.js.flow +1 -1
  139. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +15 -8
  140. package/relay-hooks/MatchContainer.js.flow +1 -1
  141. package/relay-hooks/ProfilerContext.js.flow +1 -1
  142. package/relay-hooks/QueryResource.js.flow +25 -5
  143. package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -2
  144. package/relay-hooks/SuspenseResource.js.flow +1 -1
  145. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -1
  146. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +2 -2
  147. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +3 -1
  148. package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +3 -1
  149. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +35 -33
  150. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +1 -1
  151. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +33 -32
  152. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +18 -18
  153. package/relay-hooks/__flowtests__/utils.js.flow +13 -2
  154. package/relay-hooks/loadEntryPoint.js.flow +11 -6
  155. package/relay-hooks/loadQuery.js.flow +11 -7
  156. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +5 -6
  157. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +13 -8
  158. package/relay-hooks/react-cache/RelayReactCache.js.flow +1 -1
  159. package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +4 -4
  160. package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +3 -3
  161. package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +4 -4
  162. package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +1 -1
  163. package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +1 -1
  164. package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +41 -22
  165. package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +1 -2
  166. package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +11 -5
  167. package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +2 -2
  168. package/relay-hooks/useBlockingPaginationFragment.js.flow +85 -56
  169. package/relay-hooks/useClientQuery.js.flow +1 -1
  170. package/relay-hooks/useEntryPointLoader.js.flow +10 -6
  171. package/relay-hooks/useFetchTrackingRef.js.flow +5 -4
  172. package/relay-hooks/useFragment.js.flow +2 -2
  173. package/relay-hooks/useFragmentNode.js.flow +5 -4
  174. package/relay-hooks/useIsMountedRef.js.flow +1 -1
  175. package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
  176. package/relay-hooks/useIsParentQueryActive.js.flow +1 -1
  177. package/relay-hooks/useLazyLoadQuery.js.flow +2 -2
  178. package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -2
  179. package/relay-hooks/useLoadMoreFunction.js.flow +14 -9
  180. package/relay-hooks/useMemoOperationDescriptor.js.flow +3 -3
  181. package/relay-hooks/useMemoVariables.js.flow +13 -29
  182. package/relay-hooks/useMutation.js.flow +4 -4
  183. package/relay-hooks/usePaginationFragment.js.flow +53 -46
  184. package/relay-hooks/usePreloadedQuery.js.flow +47 -22
  185. package/relay-hooks/useQueryLoader.js.flow +85 -22
  186. package/relay-hooks/useRefetchableFragment.js.flow +64 -33
  187. package/relay-hooks/useRefetchableFragmentNode.js.flow +10 -4
  188. package/relay-hooks/useRelayEnvironment.js.flow +2 -2
  189. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +3 -3
  190. package/relay-hooks/useSubscribeToInvalidationState.js.flow +2 -2
  191. package/relay-hooks/useSubscription.js.flow +1 -1
  192. package/relay-hooks/useUnsafeRef_DEPRECATED.js.flow +25 -0
  193. package/lib/readContext.js +0 -27
  194. package/readContext.js.flow +0 -29
@@ -4,25 +4,22 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+relay
8
7
  *
9
8
  * @format
9
+ * @oncall relay
10
10
  */
11
+
11
12
  'use strict';
12
13
 
13
14
  var warning = require("fbjs/lib/warning");
14
-
15
15
  var implementation = null;
16
-
17
16
  function inject(impl) {
18
17
  process.env.NODE_ENV !== "production" ? warning(implementation !== null, 'Relay HooksImplementation was injected twice.') : void 0;
19
18
  implementation = impl;
20
19
  }
21
-
22
20
  function get() {
23
21
  return implementation;
24
22
  }
25
-
26
23
  module.exports = {
27
24
  inject: inject,
28
25
  get: get
@@ -4,14 +4,14 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+relay
8
7
  *
9
8
  * @format
9
+ * @oncall relay
10
10
  */
11
+
11
12
  'use strict';
12
13
 
13
14
  var loggerImpl = function loggerImpl(eventData) {};
14
-
15
15
  module.exports = {
16
16
  setLoggerImplementation: function setLoggerImplementation(loggerFn) {
17
17
  loggerImpl = loggerFn;
@@ -5,13 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  *
8
- * @emails oncall+relay
9
8
  * @format
9
+ * @oncall relay
10
10
  */
11
+
11
12
  'use strict';
12
13
 
13
14
  var invariant = require('invariant');
14
-
15
15
  /**
16
16
  * JS maps (both plain objects and Map) maintain key insertion
17
17
  * order, which means there is an easy way to simulate LRU behavior
@@ -29,62 +29,45 @@ var LRUCache = /*#__PURE__*/function () {
29
29
  !(this._capacity > 0) ? process.env.NODE_ENV !== "production" ? invariant(false, 'LRUCache: Unable to create instance of cache with zero or negative capacity.') : invariant(false) : void 0;
30
30
  this._map = new Map();
31
31
  }
32
-
33
32
  var _proto = LRUCache.prototype;
34
-
35
33
  _proto.set = function set(key, value) {
36
34
  this._map["delete"](key);
37
-
38
35
  this._map.set(key, value);
39
-
40
36
  if (this._map.size > this._capacity) {
41
37
  var firstKey = this._map.keys().next();
42
-
43
38
  if (!firstKey.done) {
44
39
  this._map["delete"](firstKey.value);
45
40
  }
46
41
  }
47
42
  };
48
-
49
43
  _proto.get = function get(key) {
50
44
  var value = this._map.get(key);
51
-
52
45
  if (value != null) {
53
46
  this._map["delete"](key);
54
-
55
47
  this._map.set(key, value);
56
48
  }
57
-
58
49
  return value;
59
50
  };
60
-
61
51
  _proto.has = function has(key) {
62
52
  return this._map.has(key);
63
53
  };
64
-
65
54
  _proto["delete"] = function _delete(key) {
66
55
  this._map["delete"](key);
67
56
  };
68
-
69
57
  _proto.size = function size() {
70
58
  return this._map.size;
71
59
  };
72
-
73
60
  _proto.capacity = function capacity() {
74
61
  return this._capacity - this._map.size;
75
62
  };
76
-
77
63
  _proto.clear = function clear() {
78
64
  this._map.clear();
79
65
  };
80
-
81
66
  return LRUCache;
82
67
  }();
83
-
84
68
  function create(capacity) {
85
69
  return new LRUCache(capacity);
86
70
  }
87
-
88
71
  module.exports = {
89
72
  create: create
90
73
  };
@@ -4,124 +4,105 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+relay
8
7
  *
9
8
  * @format
9
+ * @oncall relay
10
10
  */
11
+
11
12
  'use strict';
12
13
 
13
14
  var preloadQuery_DEPRECATED = require('./preloadQuery_DEPRECATED');
14
-
15
15
  var ProfilerContext = require('./ProfilerContext');
16
-
17
16
  var useRelayEnvironment = require('./useRelayEnvironment');
18
-
19
17
  var React = require('react');
20
-
21
18
  var _require = require('react'),
22
- useContext = _require.useContext,
23
- useEffect = _require.useEffect,
24
- useMemo = _require.useMemo;
25
-
19
+ useContext = _require.useContext,
20
+ useEffect = _require.useEffect,
21
+ useMemo = _require.useMemo;
26
22
  var _require2 = require('relay-runtime'),
27
- stableCopy = _require2.stableCopy;
28
-
23
+ stableCopy = _require2.stableCopy;
29
24
  function stableStringify(value) {
30
25
  var _JSON$stringify;
31
-
32
26
  return (_JSON$stringify = JSON.stringify(stableCopy(value))) !== null && _JSON$stringify !== void 0 ? _JSON$stringify : 'null';
33
27
  }
34
-
35
28
  function prepareEntryPoint(environmentProvider, entryPoint, entryPointParams) {
36
29
  // Start loading the code for the entrypoint
37
30
  var loadingPromise = null;
38
-
39
31
  if (entryPoint.root.getModuleIfRequired() == null) {
40
32
  loadingPromise = entryPoint.root.load();
41
33
  }
42
-
43
34
  var preloadProps = entryPoint.getPreloadProps(entryPointParams);
44
35
  var queries = preloadProps.queries,
45
- entryPoints = preloadProps.entryPoints,
46
- extraProps = preloadProps.extraProps;
36
+ entryPoints = preloadProps.entryPoints,
37
+ extraProps = preloadProps.extraProps;
47
38
  var preloadedQueries = {};
48
39
  var preloadedEntryPoints = {};
49
-
50
40
  if (queries != null) {
51
41
  var queriesPropNames = Object.keys(queries);
52
42
  queriesPropNames.forEach(function (queryPropName) {
53
43
  var _queries$queryPropNam = queries[queryPropName],
54
- environmentProviderOptions = _queries$queryPropNam.environmentProviderOptions,
55
- options = _queries$queryPropNam.options,
56
- parameters = _queries$queryPropNam.parameters,
57
- variables = _queries$queryPropNam.variables;
44
+ environmentProviderOptions = _queries$queryPropNam.environmentProviderOptions,
45
+ options = _queries$queryPropNam.options,
46
+ parameters = _queries$queryPropNam.parameters,
47
+ variables = _queries$queryPropNam.variables;
58
48
  var environment = environmentProvider.getEnvironment(environmentProviderOptions);
59
49
  preloadedQueries[queryPropName] = preloadQuery_DEPRECATED(environment, parameters, variables, options, environmentProviderOptions);
60
50
  });
61
51
  }
62
-
63
52
  if (entryPoints != null) {
64
53
  var entryPointPropNames = Object.keys(entryPoints);
65
54
  entryPointPropNames.forEach(function (entryPointPropName) {
66
55
  var entryPointDescription = entryPoints[entryPointPropName];
67
-
68
56
  if (entryPointDescription == null) {
69
57
  return;
70
58
  }
71
-
72
59
  var nestedEntryPoint = entryPointDescription.entryPoint,
73
- nestedParams = entryPointDescription.entryPointParams;
60
+ nestedParams = entryPointDescription.entryPointParams;
74
61
  preloadedEntryPoints[entryPointPropName] = prepareEntryPoint(environmentProvider, nestedEntryPoint, nestedParams);
75
62
  });
76
63
  }
77
-
78
64
  return {
79
65
  entryPoints: preloadedEntryPoints,
80
66
  extraProps: extraProps !== null && extraProps !== void 0 ? extraProps : null,
81
67
  getComponent: function getComponent() {
82
68
  var component = entryPoint.root.getModuleIfRequired();
83
-
84
69
  if (component == null) {
85
70
  var _loadingPromise;
86
-
87
71
  loadingPromise = (_loadingPromise = loadingPromise) !== null && _loadingPromise !== void 0 ? _loadingPromise : entryPoint.root.load();
88
72
  throw loadingPromise;
89
- } // $FlowFixMe[incompatible-cast] - trust me Flow, its entryPoint component
90
-
91
-
73
+ }
74
+ // $FlowFixMe[incompatible-cast] - trust me Flow, its entryPoint component
92
75
  return component;
93
76
  },
94
77
  queries: preloadedQueries,
95
78
  rootModuleID: entryPoint.root.getModuleId()
96
79
  };
97
80
  }
98
-
99
81
  function LazyLoadEntryPointContainer_DEPRECATED(_ref) {
100
82
  var entryPoint = _ref.entryPoint,
101
- entryPointParams = _ref.entryPointParams,
102
- props = _ref.props,
103
- environmentProvider = _ref.environmentProvider;
83
+ entryPointParams = _ref.entryPointParams,
84
+ props = _ref.props,
85
+ environmentProvider = _ref.environmentProvider;
104
86
  var environment = useRelayEnvironment();
105
- var getPreloadProps = entryPoint.getPreloadProps; // IMPORTANT: Loading the component may suspend (throw), so the props
87
+ var getPreloadProps = entryPoint.getPreloadProps;
88
+ // IMPORTANT: Loading the component may suspend (throw), so the props
106
89
  // *must* be computed first to fetch the component's data-dependencies in
107
90
  // parallel with the component itself (the code).
108
-
109
91
  var entryPointParamsHash = stableStringify(entryPointParams);
110
-
111
92
  var _useMemo = useMemo(function () {
112
- return prepareEntryPoint(environmentProvider !== null && environmentProvider !== void 0 ? environmentProvider : {
113
- getEnvironment: function getEnvironment() {
114
- return environment;
115
- }
116
- }, entryPoint, entryPointParams); // NOTE: stableParams encodes the information from params
117
- // eslint-disable-next-line react-hooks/exhaustive-deps
118
- }, [environment, environmentProvider, getPreloadProps, entryPointParamsHash]),
119
- getComponent = _useMemo.getComponent,
120
- queries = _useMemo.queries,
121
- entryPoints = _useMemo.entryPoints,
122
- extraProps = _useMemo.extraProps,
123
- rootModuleID = _useMemo.rootModuleID;
124
-
93
+ return prepareEntryPoint(environmentProvider !== null && environmentProvider !== void 0 ? environmentProvider : {
94
+ getEnvironment: function getEnvironment() {
95
+ return environment;
96
+ }
97
+ }, entryPoint, entryPointParams);
98
+ // NOTE: stableParams encodes the information from params
99
+ // eslint-disable-next-line react-hooks/exhaustive-deps
100
+ }, [environment, environmentProvider, getPreloadProps, entryPointParamsHash]),
101
+ getComponent = _useMemo.getComponent,
102
+ queries = _useMemo.queries,
103
+ entryPoints = _useMemo.entryPoints,
104
+ extraProps = _useMemo.extraProps,
105
+ rootModuleID = _useMemo.rootModuleID;
125
106
  var Component = useMemo(function () {
126
107
  return getComponent();
127
108
  }, [getComponent]);
@@ -140,5 +121,4 @@ function LazyLoadEntryPointContainer_DEPRECATED(_ref) {
140
121
  queries: queries
141
122
  });
142
123
  }
143
-
144
124
  module.exports = LazyLoadEntryPointContainer_DEPRECATED;
@@ -4,19 +4,18 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+relay
8
7
  *
9
8
  * @format
9
+ * @oncall relay
10
10
  */
11
+
11
12
  'use strict';
12
13
 
13
14
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
-
15
15
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
-
17
16
  var React = require('react');
18
-
19
17
  var useMemo = React.useMemo;
18
+
20
19
  /**
21
20
  * Renders the results of a data-driven dependency fetched with the `@match`
22
21
  * directive. The `@match` directive can be used to specify a mapping of
@@ -84,39 +83,35 @@ var useMemo = React.useMemo;
84
83
  * your server returns for the `js(moduleName: String)` field).
85
84
  *
86
85
  */
86
+
87
87
  // Note: this type is intentionally non-exact, it is expected that the
88
88
  // object may contain sibling fields.
89
89
 
90
90
  function MatchContainer(_ref2) {
91
91
  var _ref;
92
-
93
92
  var fallback = _ref2.fallback,
94
- loader = _ref2.loader,
95
- match = _ref2.match,
96
- props = _ref2.props;
97
-
93
+ loader = _ref2.loader,
94
+ match = _ref2.match,
95
+ props = _ref2.props;
98
96
  if (match != null && typeof match !== 'object') {
99
97
  throw new Error('MatchContainer: Expected `match` value to be an object or null/undefined.');
100
- } // NOTE: the MatchPointer type has a $fragmentSpreads field to ensure that only
98
+ }
99
+ // NOTE: the MatchPointer type has a $fragmentSpreads field to ensure that only
101
100
  // an object that contains a FragmentSpread can be passed. If the fragment
102
101
  // spread matches, then the metadata fields below (__id, __fragments, etc.)
103
102
  // will be present. But they can be missing if all the fragment spreads use
104
103
  // @module and none of the types matched. The cast here is necessary because
105
104
  // fragment Flow types don't describe metadata fields, only the actual schema
106
105
  // fields the developer selected.
107
-
108
-
109
106
  var _ref3 = (_ref = match) !== null && _ref !== void 0 ? _ref : {},
110
- __id = _ref3.__id,
111
- __fragments = _ref3.__fragments,
112
- __fragmentOwner = _ref3.__fragmentOwner,
113
- __fragmentPropName = _ref3.__fragmentPropName,
114
- __module_component = _ref3.__module_component;
115
-
107
+ __id = _ref3.__id,
108
+ __fragments = _ref3.__fragments,
109
+ __fragmentOwner = _ref3.__fragmentOwner,
110
+ __fragmentPropName = _ref3.__fragmentPropName,
111
+ __module_component = _ref3.__module_component;
116
112
  if (__fragmentOwner != null && typeof __fragmentOwner !== 'object' || __fragmentPropName != null && typeof __fragmentPropName !== 'string' || __fragments != null && typeof __fragments !== 'object' || __id != null && typeof __id !== 'string') {
117
113
  throw new Error("MatchContainer: Invalid 'match' value, expected an object that has a " + "'...SomeFragment' spread.");
118
114
  }
119
-
120
115
  var LoadedContainer = __module_component != null ? loader(__module_component) : null;
121
116
  var fragmentProps = useMemo(function () {
122
117
  // TODO: Perform this transformation in RelayReader so that unchanged
@@ -130,10 +125,8 @@ function MatchContainer(_ref2) {
130
125
  };
131
126
  return fragProps;
132
127
  }
133
-
134
128
  return null;
135
129
  }, [__id, __fragments, __fragmentOwner, __fragmentPropName]);
136
-
137
130
  if (LoadedContainer != null && fragmentProps != null) {
138
131
  // $FlowFixMe[incompatible-type]
139
132
  // $FlowFixMe[cannot-spread-indexer]
@@ -142,5 +135,4 @@ function MatchContainer(_ref2) {
142
135
  return fallback !== null && fallback !== void 0 ? fallback : null;
143
136
  }
144
137
  }
145
-
146
138
  module.exports = MatchContainer;
@@ -4,17 +4,18 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @emails oncall+relay
8
7
  *
9
8
  * @format
9
+ * @oncall relay
10
10
  */
11
+
11
12
  // This contextual profiler can be used to wrap a react sub-tree. It will bind
12
13
  // the RelayProfiler during the render phase of these components. Allows
13
14
  // collecting metrics for a specific part of your application.
15
+
14
16
  'use strict';
15
17
 
16
18
  var React = require('react');
17
-
18
19
  var ProfilerContext = React.createContext({
19
20
  wrapPrepareQueryResource: function wrapPrepareQueryResource(cb) {
20
21
  return cb();