react-relay 14.0.0 → 14.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (163) hide show
  1. package/ReactRelayContainerUtils.js.flow +0 -2
  2. package/ReactRelayContext.js +1 -1
  3. package/ReactRelayContext.js.flow +0 -2
  4. package/ReactRelayFragmentContainer.js.flow +0 -2
  5. package/ReactRelayFragmentMockRenderer.js.flow +0 -2
  6. package/ReactRelayLocalQueryRenderer.js.flow +0 -2
  7. package/ReactRelayPaginationContainer.js.flow +0 -2
  8. package/ReactRelayQueryFetcher.js.flow +9 -11
  9. package/ReactRelayQueryRenderer.js.flow +10 -12
  10. package/ReactRelayQueryRendererContext.js.flow +1 -3
  11. package/ReactRelayRefetchContainer.js.flow +0 -4
  12. package/ReactRelayTestMocker.js.flow +0 -2
  13. package/ReactRelayTypes.js.flow +6 -8
  14. package/RelayContext.js.flow +0 -2
  15. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -4
  16. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +3 -5
  17. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +3 -5
  18. package/__flowtests__/RelayModern-flowtest.js.flow +2 -4
  19. package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +2 -4
  20. package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +2 -4
  21. package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +2 -4
  22. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +2 -4
  23. package/assertFragmentMap.js.flow +0 -2
  24. package/buildReactRelayContainer.js.flow +0 -2
  25. package/getRootVariablesForFragments.js.flow +0 -2
  26. package/hooks.js +1 -1
  27. package/hooks.js.flow +0 -2
  28. package/index.js +1 -1
  29. package/index.js.flow +2 -2
  30. package/isRelayEnvironment.js.flow +0 -2
  31. package/legacy.js +1 -1
  32. package/legacy.js.flow +0 -2
  33. package/lib/ReactRelayContainerUtils.js +0 -1
  34. package/lib/ReactRelayContext.js +0 -1
  35. package/lib/ReactRelayFragmentContainer.js +10 -9
  36. package/lib/ReactRelayFragmentMockRenderer.js +0 -1
  37. package/lib/ReactRelayLocalQueryRenderer.js +0 -1
  38. package/lib/ReactRelayPaginationContainer.js +14 -11
  39. package/lib/ReactRelayQueryFetcher.js +1 -2
  40. package/lib/ReactRelayQueryRenderer.js +1 -2
  41. package/lib/ReactRelayQueryRendererContext.js +0 -1
  42. package/lib/ReactRelayRefetchContainer.js +11 -14
  43. package/lib/ReactRelayTestMocker.js +1 -2
  44. package/lib/ReactRelayTypes.js +0 -1
  45. package/lib/RelayContext.js +0 -1
  46. package/lib/assertFragmentMap.js +0 -1
  47. package/lib/buildReactRelayContainer.js +1 -2
  48. package/lib/getRootVariablesForFragments.js +1 -2
  49. package/lib/hooks.js +0 -1
  50. package/lib/index.js +3 -1
  51. package/lib/isRelayEnvironment.js +0 -1
  52. package/lib/legacy.js +0 -1
  53. package/lib/multi-actor/useRelayActorEnvironment.js +0 -1
  54. package/lib/readContext.js +0 -1
  55. package/lib/relay-hooks/EntryPointContainer.react.js +0 -1
  56. package/lib/relay-hooks/EntryPointTypes.flow.js +0 -1
  57. package/lib/relay-hooks/FragmentResource.js +7 -7
  58. package/lib/relay-hooks/HooksImplementation.js +1 -1
  59. package/lib/relay-hooks/InternalLogger.js +0 -1
  60. package/lib/relay-hooks/LRUCache.js +0 -1
  61. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +0 -1
  62. package/lib/relay-hooks/MatchContainer.js +1 -2
  63. package/lib/relay-hooks/ProfilerContext.js +0 -1
  64. package/lib/relay-hooks/QueryResource.js +1 -2
  65. package/lib/relay-hooks/RelayEnvironmentProvider.js +0 -1
  66. package/lib/relay-hooks/SuspenseResource.js +1 -2
  67. package/lib/relay-hooks/loadQuery.js +1 -1
  68. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +1 -2
  69. package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +0 -1
  70. package/lib/relay-hooks/react-cache/RelayReactCache.js +0 -1
  71. package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +3 -3
  72. package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +239 -0
  73. package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +183 -125
  74. package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +0 -1
  75. package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +0 -1
  76. package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +150 -0
  77. package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +0 -1
  78. package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +367 -0
  79. package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +45 -0
  80. package/lib/relay-hooks/useBlockingPaginationFragment.js +4 -3
  81. package/lib/relay-hooks/useClientQuery.js +33 -0
  82. package/lib/relay-hooks/useEntryPointLoader.js +1 -2
  83. package/lib/relay-hooks/useFetchTrackingRef.js +0 -1
  84. package/lib/relay-hooks/useFragment.js +0 -1
  85. package/lib/relay-hooks/useFragmentNode.js +0 -1
  86. package/lib/relay-hooks/useIsMountedRef.js +0 -1
  87. package/lib/relay-hooks/useLazyLoadQuery.js +1 -15
  88. package/lib/relay-hooks/useLazyLoadQueryNode.js +0 -1
  89. package/lib/relay-hooks/useLoadMoreFunction.js +1 -2
  90. package/lib/relay-hooks/useMemoOperationDescriptor.js +0 -1
  91. package/lib/relay-hooks/useMemoVariables.js +0 -1
  92. package/lib/relay-hooks/useMutation.js +1 -2
  93. package/lib/relay-hooks/usePaginationFragment.js +15 -3
  94. package/lib/relay-hooks/usePreloadedQuery.js +1 -15
  95. package/lib/relay-hooks/useQueryLoader.js +1 -2
  96. package/lib/relay-hooks/useRefetchableFragment.js +14 -2
  97. package/lib/relay-hooks/useRefetchableFragmentNode.js +1 -2
  98. package/lib/relay-hooks/useRelayEnvironment.js +0 -1
  99. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +0 -1
  100. package/lib/relay-hooks/useSubscribeToInvalidationState.js +0 -1
  101. package/lib/relay-hooks/useSubscription.js +0 -1
  102. package/multi-actor/useRelayActorEnvironment.js.flow +0 -2
  103. package/package.json +2 -2
  104. package/react-relay-hooks.js +2 -2
  105. package/react-relay-hooks.min.js +2 -2
  106. package/react-relay-legacy.js +2 -2
  107. package/react-relay-legacy.min.js +2 -2
  108. package/react-relay.js +2 -2
  109. package/react-relay.min.js +2 -2
  110. package/readContext.js.flow +0 -2
  111. package/relay-hooks/EntryPointContainer.react.js.flow +2 -4
  112. package/relay-hooks/EntryPointTypes.flow.js.flow +30 -32
  113. package/relay-hooks/FragmentResource.js.flow +9 -11
  114. package/relay-hooks/HooksImplementation.js.flow +6 -8
  115. package/relay-hooks/InternalLogger.js.flow +0 -2
  116. package/relay-hooks/LRUCache.js.flow +0 -2
  117. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +4 -6
  118. package/relay-hooks/MatchContainer.js.flow +5 -7
  119. package/relay-hooks/ProfilerContext.js.flow +0 -2
  120. package/relay-hooks/QueryResource.js.flow +4 -6
  121. package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -4
  122. package/relay-hooks/SuspenseResource.js.flow +0 -2
  123. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -3
  124. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +2 -2
  125. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +4 -6
  126. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +0 -2
  127. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +4 -6
  128. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +0 -2
  129. package/relay-hooks/__flowtests__/utils.js.flow +8 -10
  130. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +4 -6
  131. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +0 -2
  132. package/relay-hooks/react-cache/RelayReactCache.js.flow +0 -2
  133. package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +22 -16
  134. package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +297 -0
  135. package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +134 -94
  136. package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +0 -2
  137. package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +2 -4
  138. package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +171 -0
  139. package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +2 -4
  140. package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +595 -0
  141. package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +65 -0
  142. package/relay-hooks/useBlockingPaginationFragment.js.flow +4 -6
  143. package/relay-hooks/useClientQuery.js.flow +39 -0
  144. package/relay-hooks/useEntryPointLoader.js.flow +6 -8
  145. package/relay-hooks/useFetchTrackingRef.js.flow +2 -4
  146. package/relay-hooks/useFragment.js.flow +0 -2
  147. package/relay-hooks/useFragmentNode.js.flow +2 -4
  148. package/relay-hooks/useIsMountedRef.js.flow +1 -3
  149. package/relay-hooks/useLazyLoadQuery.js.flow +7 -30
  150. package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -4
  151. package/relay-hooks/useLoadMoreFunction.js.flow +6 -8
  152. package/relay-hooks/useMemoOperationDescriptor.js.flow +0 -2
  153. package/relay-hooks/useMemoVariables.js.flow +0 -2
  154. package/relay-hooks/useMutation.js.flow +2 -4
  155. package/relay-hooks/usePaginationFragment.js.flow +44 -19
  156. package/relay-hooks/usePreloadedQuery.js.flow +5 -24
  157. package/relay-hooks/useQueryLoader.js.flow +4 -6
  158. package/relay-hooks/useRefetchableFragment.js.flow +32 -3
  159. package/relay-hooks/useRefetchableFragmentNode.js.flow +16 -18
  160. package/relay-hooks/useRelayEnvironment.js.flow +0 -2
  161. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +0 -2
  162. package/relay-hooks/useSubscribeToInvalidationState.js.flow +0 -2
  163. package/relay-hooks/useSubscription.js.flow +0 -2
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
15
 
@@ -22,6 +21,8 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
22
21
 
23
22
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
24
23
 
24
+ var _excluded = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
25
+
25
26
  var buildReactRelayContainer = require('./buildReactRelayContainer');
26
27
 
27
28
  var _require = require('./ReactRelayContainerUtils'),
@@ -45,10 +46,10 @@ var _require3 = require('relay-runtime'),
45
46
  * updates.
46
47
  */
47
48
  function createContainerWithFragments(Component, fragments) {
48
- var _class, _temp;
49
+ var _class;
49
50
 
50
51
  var containerName = getContainerName(Component);
51
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
52
+ return _class = /*#__PURE__*/function (_React$Component) {
52
53
  (0, _inheritsLoose2["default"])(_class, _React$Component);
53
54
 
54
55
  function _class(props) {
@@ -168,14 +169,14 @@ function createContainerWithFragments(Component, fragments) {
168
169
  var keys = Object.keys(nextProps);
169
170
 
170
171
  for (var ii = 0; ii < keys.length; ii++) {
171
- var _key = keys[ii];
172
+ var key = keys[ii];
172
173
 
173
- if (_key === '__relayContext') {
174
+ if (key === '__relayContext') {
174
175
  if (nextState.prevPropsContext.environment !== this.state.prevPropsContext.environment) {
175
176
  return true;
176
177
  }
177
178
  } else {
178
- if (!fragments.hasOwnProperty(_key) && !isScalarAndEqual(nextProps[_key], this.props[_key])) {
179
+ if (!fragments.hasOwnProperty(key) && !isScalarAndEqual(nextProps[key], this.props[key])) {
179
180
  return true;
180
181
  }
181
182
  }
@@ -225,7 +226,7 @@ function createContainerWithFragments(Component, fragments) {
225
226
  componentRef = _this$props.componentRef,
226
227
  __relayContext = _this$props.__relayContext,
227
228
  __rootIsQueryRenderer = _this$props.__rootIsQueryRenderer,
228
- props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
229
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
229
230
  return React.createElement(Component, (0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, props), this.state.data), {}, {
230
231
  ref: componentRef,
231
232
  relay: this.state.relayProp
@@ -233,7 +234,7 @@ function createContainerWithFragments(Component, fragments) {
233
234
  };
234
235
 
235
236
  return _class;
236
- }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _temp;
237
+ }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
237
238
  }
238
239
 
239
240
  function getRelayProp(environment) {
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var ReactRelayContext = require('./ReactRelayContext');
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var ReactRelayContext = require('./ReactRelayContext');
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
15
 
@@ -24,6 +23,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
24
23
 
25
24
  var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
26
25
 
26
+ var _excluded = ["componentRef"],
27
+ _excluded2 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"],
28
+ _excluded3 = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
29
+
27
30
  var buildReactRelayContainer = require('./buildReactRelayContainer');
28
31
 
29
32
  var getRootVariablesForFragments = require('./getRootVariablesForFragments');
@@ -255,7 +258,7 @@ function toObserver(observerOrCallback) {
255
258
  }
256
259
 
257
260
  function createContainerWithFragments(Component, fragments, connectionConfig) {
258
- var _class, _temp;
261
+ var _class;
259
262
 
260
263
  var componentName = getComponentName(Component);
261
264
  var containerName = getContainerName(Component);
@@ -264,7 +267,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
264
267
  var direction = connectionConfig.direction || metadata.direction;
265
268
  !direction ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Unable to infer direction of the ' + 'connection, possibly because both first and last are provided.') : invariant(false) : void 0;
266
269
  var getFragmentVariables = connectionConfig.getFragmentVariables || createGetFragmentVariables(metadata);
267
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
270
+ return _class = /*#__PURE__*/function (_React$Component) {
268
271
  (0, _inheritsLoose2["default"])(_class, _React$Component);
269
272
 
270
273
  function _class(props) {
@@ -462,14 +465,14 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
462
465
  var keys = Object.keys(nextProps);
463
466
 
464
467
  for (var ii = 0; ii < keys.length; ii++) {
465
- var _key = keys[ii];
468
+ var key = keys[ii];
466
469
 
467
- if (_key === '__relayContext') {
470
+ if (key === '__relayContext') {
468
471
  if (nextState.prevContext.environment !== this.state.prevContext.environment) {
469
472
  return true;
470
473
  }
471
474
  } else {
472
- if (!fragments.hasOwnProperty(_key) && !isScalarAndEqual(nextProps[_key], this.props[_key])) {
475
+ if (!fragments.hasOwnProperty(key) && !isScalarAndEqual(nextProps[key], this.props[key])) {
473
476
  return true;
474
477
  }
475
478
  }
@@ -527,7 +530,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
527
530
  // Extract connection data and verify there are more edges to fetch
528
531
  var _this$props = this.props,
529
532
  _ = _this$props.componentRef,
530
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, ["componentRef"]);
533
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
531
534
  var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
532
535
  var connectionData = getConnectionFromProps(props);
533
536
 
@@ -595,7 +598,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
595
598
  _ = _this$props2.componentRef,
596
599
  __relayContext = _this$props2.__relayContext,
597
600
  __rootIsQueryRenderer = _this$props2.__rootIsQueryRenderer,
598
- restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
601
+ restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, _excluded2);
599
602
  var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
600
603
  var fragmentVariables;
601
604
  var rootVariables = getRootVariablesForFragments(fragments, restProps);
@@ -707,7 +710,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
707
710
  componentRef = _this$props3.componentRef,
708
711
  __relayContext = _this$props3.__relayContext,
709
712
  __rootIsQueryRenderer = _this$props3.__rootIsQueryRenderer,
710
- props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props3, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
713
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props3, _excluded3);
711
714
  return /*#__PURE__*/React.createElement(ReactRelayContext.Provider, {
712
715
  value: this.state.contextForChildren
713
716
  }, /*#__PURE__*/React.createElement(Component, (0, _extends2["default"])({}, props, this.state.data, {
@@ -717,7 +720,7 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
717
720
  };
718
721
 
719
722
  return _class;
720
- }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _temp;
723
+ }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
721
724
  }
722
725
  /**
723
726
  * Wrap the basic `createContainer()` function with logic to adapt to the
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
15
 
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
15
 
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var React = require('react');
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
15
 
@@ -24,6 +23,8 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
24
23
 
25
24
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
26
25
 
26
+ var _excluded = ["componentRef", "__relayContext", "__rootIsQueryRenderer"];
27
+
27
28
  var buildReactRelayContainer = require('./buildReactRelayContainer');
28
29
 
29
30
  var getRootVariablesForFragments = require('./getRootVariablesForFragments');
@@ -59,10 +60,10 @@ var warning = require("fbjs/lib/warning");
59
60
  * updates.
60
61
  */
61
62
  function createContainerWithFragments(Component, fragments, taggedNode) {
62
- var _class, _temp;
63
+ var _class;
63
64
 
64
65
  var containerName = getContainerName(Component);
65
- return _temp = _class = /*#__PURE__*/function (_React$Component) {
66
+ return _class = /*#__PURE__*/function (_React$Component) {
66
67
  (0, _inheritsLoose2["default"])(_class, _React$Component);
67
68
 
68
69
  function _class(props) {
@@ -113,11 +114,7 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
113
114
  var query = getRequest(taggedNode);
114
115
  var operation = createOperationDescriptor(query, fetchVariables, cacheConfig); // TODO: T26288752 find a better way
115
116
 
116
- /* eslint-disable lint/react-state-props-mutation */
117
-
118
- _this.state.localVariables = fetchVariables;
119
- /* eslint-enable lint/react-state-props-mutation */
120
- // Cancel any previously running refetch.
117
+ _this.state.localVariables = fetchVariables; // Cancel any previously running refetch.
121
118
 
122
119
  _this._refetchSubscription && _this._refetchSubscription.unsubscribe(); // Declare refetchSubscription before assigning it in .start(), since
123
120
  // synchronous completion may call callbacks .subscribe() returns.
@@ -304,14 +301,14 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
304
301
  var keys = Object.keys(nextProps);
305
302
 
306
303
  for (var ii = 0; ii < keys.length; ii++) {
307
- var _key = keys[ii];
304
+ var key = keys[ii];
308
305
 
309
- if (_key === '__relayContext') {
306
+ if (key === '__relayContext') {
310
307
  if (this.state.prevPropsContext.environment !== nextState.prevPropsContext.environment) {
311
308
  return true;
312
309
  }
313
310
  } else {
314
- if (!fragments.hasOwnProperty(_key) && !isScalarAndEqual(nextProps[_key], this.props[_key])) {
311
+ if (!fragments.hasOwnProperty(key) && !isScalarAndEqual(nextProps[key], this.props[key])) {
315
312
  return true;
316
313
  }
317
314
  }
@@ -373,7 +370,7 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
373
370
  componentRef = _this$props.componentRef,
374
371
  __relayContext = _this$props.__relayContext,
375
372
  __rootIsQueryRenderer = _this$props.__rootIsQueryRenderer,
376
- props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
373
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
377
374
  var _this$state3 = this.state,
378
375
  relayProp = _this$state3.relayProp,
379
376
  contextForChildren = _this$state3.contextForChildren;
@@ -386,7 +383,7 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
386
383
  };
387
384
 
388
385
  return _class;
389
- }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _temp;
386
+ }(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
390
387
  }
391
388
 
392
389
  function getRelayProp(environment, refetch) {
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
15
 
@@ -7,5 +7,4 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var isRelayEnvironment = require('./isRelayEnvironment');
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var invariant = require('invariant');
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
16
15
 
@@ -7,10 +7,9 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
13
 
15
14
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
15
 
package/lib/hooks.js CHANGED
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
package/lib/index.js CHANGED
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var ReactRelayContext = require('./ReactRelayContext');
@@ -31,6 +30,8 @@ var _require = require('./relay-hooks/loadQuery'),
31
30
 
32
31
  var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
33
32
 
33
+ var useClientQuery = require('./relay-hooks/useClientQuery');
34
+
34
35
  var useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
35
36
 
36
37
  var useFragment = require('./relay-hooks/useFragment');
@@ -83,6 +84,7 @@ module.exports = {
83
84
  fetchQuery: RelayRuntime.fetchQuery,
84
85
  loadQuery: loadQuery,
85
86
  loadEntryPoint: loadEntryPoint,
87
+ useClientQuery: useClientQuery,
86
88
  useFragment: useFragment,
87
89
  useLazyLoadQuery: useLazyLoadQuery,
88
90
  useEntryPointLoader: useEntryPointLoader,
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
  /**
13
12
  * Determine if a given value is an object that implements the `Environment`
package/lib/legacy.js CHANGED
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var ReactRelayContext = require('./ReactRelayContext');
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var invariant = require('invariant');
@@ -7,7 +7,6 @@
7
7
  *
8
8
  * @format
9
9
  */
10
- // flowlint ambiguous-object-type:error
11
10
  'use strict';
12
11
 
13
12
  var React = require('react'); // $FlowFixMe[incompatible-use]
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var ProfilerContext = require('./ProfilerContext');
@@ -8,5 +8,4 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
@@ -8,10 +8,9 @@
8
8
  * @emails oncall+relay
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
15
14
 
16
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
17
16
 
@@ -136,7 +135,8 @@ var ClientEdgeQueryResultsCache = /*#__PURE__*/function () {
136
135
  return (_this$_cache$get$ = (_this$_cache$get = this._cache.get(fragmentIdentifier)) === null || _this$_cache$get === void 0 ? void 0 : _this$_cache$get[0]) !== null && _this$_cache$get$ !== void 0 ? _this$_cache$get$ : undefined;
137
136
  };
138
137
 
139
- _proto.recordQueryResults = function recordQueryResults(fragmentIdentifier, value) {
138
+ _proto.recordQueryResults = function recordQueryResults(fragmentIdentifier, value // may be mutated after being passed here
139
+ ) {
140
140
  var _this = this;
141
141
 
142
142
  var existing = this._cache.get(fragmentIdentifier);
@@ -274,7 +274,7 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
274
274
  throw cachedValue.promise;
275
275
  }
276
276
 
277
- if (cachedValue.kind === 'done' && cachedValue.result.snapshot && !((_missingLiveResolverF = missingLiveResolverFields(cachedValue.result.snapshot)) === null || _missingLiveResolverF === void 0 ? void 0 : _missingLiveResolverF.length)) {
277
+ if (cachedValue.kind === 'done' && cachedValue.result.snapshot && !((_missingLiveResolverF = missingLiveResolverFields(cachedValue.result.snapshot)) !== null && _missingLiveResolverF !== void 0 && _missingLiveResolverF.length)) {
278
278
  this._handlePotentialSnapshotErrorsInSnapshot(cachedValue.result.snapshot);
279
279
 
280
280
  return cachedValue.result;
@@ -439,8 +439,8 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
439
439
  _proto2.readSpec = function readSpec(fragmentNodes, fragmentRefs, componentDisplayName) {
440
440
  var result = {};
441
441
 
442
- for (var _key in fragmentNodes) {
443
- result[_key] = this.read(fragmentNodes[_key], fragmentRefs[_key], componentDisplayName, _key);
442
+ for (var key in fragmentNodes) {
443
+ result[key] = this.read(fragmentNodes[key], fragmentRefs[key], componentDisplayName, key);
444
444
  }
445
445
 
446
446
  return result;
@@ -504,7 +504,7 @@ var FragmentResourceImpl = /*#__PURE__*/function () {
504
504
 
505
505
  var clientEdgeQueryResults = (_this$_clientEdgeQuer = (_this$_clientEdgeQuer2 = this._clientEdgeQueryResultsCache) === null || _this$_clientEdgeQuer2 === void 0 ? void 0 : _this$_clientEdgeQuer2.get(cacheKey)) !== null && _this$_clientEdgeQuer !== void 0 ? _this$_clientEdgeQuer : undefined;
506
506
 
507
- if (clientEdgeQueryResults === null || clientEdgeQueryResults === void 0 ? void 0 : clientEdgeQueryResults.length) {
507
+ if (clientEdgeQueryResults !== null && clientEdgeQueryResults !== void 0 && clientEdgeQueryResults.length) {
508
508
  var queryResource = getQueryResourceForEnvironment(this._environment);
509
509
  clientEdgeQueryResults.forEach(function (queryResult) {
510
510
  disposables.push(queryResource.retain(queryResult));
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- 'use strict'; // flowlint ambiguous-object-type:error
11
+ 'use strict';
12
12
 
13
13
  var warning = require("fbjs/lib/warning");
14
14
 
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var loggerImpl = function loggerImpl(eventData) {};
@@ -8,7 +8,6 @@
8
8
  * @emails oncall+relay
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var invariant = require('invariant');
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var preloadQuery_DEPRECATED = require('./preloadQuery_DEPRECATED');
@@ -8,10 +8,9 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
15
14
 
16
15
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
17
16
 
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  // This contextual profiler can be used to wrap a react sub-tree. It will bind
13
12
  // the RelayProfiler during the render phase of these components. Allows
14
13
  // collecting metrics for a specific part of your application.
@@ -8,10 +8,9 @@
8
8
  * @emails oncall+relay
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
15
14
 
16
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
17
16
 
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var React = require('react');
@@ -8,10 +8,9 @@
8
8
  * @emails oncall+relay
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
15
14
 
16
15
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
16
 
@@ -10,7 +10,7 @@
10
10
  */
11
11
  'use strict';
12
12
 
13
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
14
14
 
15
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
16
16
 
@@ -8,10 +8,9 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
15
14
 
16
15
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
17
16
 
@@ -8,7 +8,6 @@
8
8
  *
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var preloadQuery = require('./preloadQuery_DEPRECATED');
@@ -8,7 +8,6 @@
8
8
  * @emails oncall+relay
9
9
  * @format
10
10
  */
11
- // flowlint ambiguous-object-type:error
12
11
  'use strict';
13
12
 
14
13
  var invariant = require('invariant'); // $FlowFixMe[prop-missing] These exist in experimental builds but aren't in React's types yet.