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.
- package/ReactRelayContainerUtils.js.flow +0 -2
- package/ReactRelayContext.js +1 -1
- package/ReactRelayContext.js.flow +0 -2
- package/ReactRelayFragmentContainer.js.flow +0 -2
- package/ReactRelayFragmentMockRenderer.js.flow +0 -2
- package/ReactRelayLocalQueryRenderer.js.flow +0 -2
- package/ReactRelayPaginationContainer.js.flow +0 -2
- package/ReactRelayQueryFetcher.js.flow +9 -11
- package/ReactRelayQueryRenderer.js.flow +10 -12
- package/ReactRelayQueryRendererContext.js.flow +1 -3
- package/ReactRelayRefetchContainer.js.flow +0 -4
- package/ReactRelayTestMocker.js.flow +0 -2
- package/ReactRelayTypes.js.flow +6 -8
- package/RelayContext.js.flow +0 -2
- package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -4
- package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +3 -5
- package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +3 -5
- package/__flowtests__/RelayModern-flowtest.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +2 -4
- package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +2 -4
- package/assertFragmentMap.js.flow +0 -2
- package/buildReactRelayContainer.js.flow +0 -2
- package/getRootVariablesForFragments.js.flow +0 -2
- package/hooks.js +1 -1
- package/hooks.js.flow +0 -2
- package/index.js +1 -1
- package/index.js.flow +2 -2
- package/isRelayEnvironment.js.flow +0 -2
- package/legacy.js +1 -1
- package/legacy.js.flow +0 -2
- package/lib/ReactRelayContainerUtils.js +0 -1
- package/lib/ReactRelayContext.js +0 -1
- package/lib/ReactRelayFragmentContainer.js +10 -9
- package/lib/ReactRelayFragmentMockRenderer.js +0 -1
- package/lib/ReactRelayLocalQueryRenderer.js +0 -1
- package/lib/ReactRelayPaginationContainer.js +14 -11
- package/lib/ReactRelayQueryFetcher.js +1 -2
- package/lib/ReactRelayQueryRenderer.js +1 -2
- package/lib/ReactRelayQueryRendererContext.js +0 -1
- package/lib/ReactRelayRefetchContainer.js +11 -14
- package/lib/ReactRelayTestMocker.js +1 -2
- package/lib/ReactRelayTypes.js +0 -1
- package/lib/RelayContext.js +0 -1
- package/lib/assertFragmentMap.js +0 -1
- package/lib/buildReactRelayContainer.js +1 -2
- package/lib/getRootVariablesForFragments.js +1 -2
- package/lib/hooks.js +0 -1
- package/lib/index.js +3 -1
- package/lib/isRelayEnvironment.js +0 -1
- package/lib/legacy.js +0 -1
- package/lib/multi-actor/useRelayActorEnvironment.js +0 -1
- package/lib/readContext.js +0 -1
- package/lib/relay-hooks/EntryPointContainer.react.js +0 -1
- package/lib/relay-hooks/EntryPointTypes.flow.js +0 -1
- package/lib/relay-hooks/FragmentResource.js +7 -7
- package/lib/relay-hooks/HooksImplementation.js +1 -1
- package/lib/relay-hooks/InternalLogger.js +0 -1
- package/lib/relay-hooks/LRUCache.js +0 -1
- package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +0 -1
- package/lib/relay-hooks/MatchContainer.js +1 -2
- package/lib/relay-hooks/ProfilerContext.js +0 -1
- package/lib/relay-hooks/QueryResource.js +1 -2
- package/lib/relay-hooks/RelayEnvironmentProvider.js +0 -1
- package/lib/relay-hooks/SuspenseResource.js +1 -2
- package/lib/relay-hooks/loadQuery.js +1 -1
- package/lib/relay-hooks/preloadQuery_DEPRECATED.js +1 -2
- package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +0 -1
- package/lib/relay-hooks/react-cache/RelayReactCache.js +0 -1
- package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +3 -3
- package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +239 -0
- package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +183 -125
- package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +0 -1
- package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +0 -1
- package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +150 -0
- package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +0 -1
- package/lib/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js +367 -0
- package/lib/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js +45 -0
- package/lib/relay-hooks/useBlockingPaginationFragment.js +4 -3
- package/lib/relay-hooks/useClientQuery.js +33 -0
- package/lib/relay-hooks/useEntryPointLoader.js +1 -2
- package/lib/relay-hooks/useFetchTrackingRef.js +0 -1
- package/lib/relay-hooks/useFragment.js +0 -1
- package/lib/relay-hooks/useFragmentNode.js +0 -1
- package/lib/relay-hooks/useIsMountedRef.js +0 -1
- package/lib/relay-hooks/useLazyLoadQuery.js +1 -15
- package/lib/relay-hooks/useLazyLoadQueryNode.js +0 -1
- package/lib/relay-hooks/useLoadMoreFunction.js +1 -2
- package/lib/relay-hooks/useMemoOperationDescriptor.js +0 -1
- package/lib/relay-hooks/useMemoVariables.js +0 -1
- package/lib/relay-hooks/useMutation.js +1 -2
- package/lib/relay-hooks/usePaginationFragment.js +15 -3
- package/lib/relay-hooks/usePreloadedQuery.js +1 -15
- package/lib/relay-hooks/useQueryLoader.js +1 -2
- package/lib/relay-hooks/useRefetchableFragment.js +14 -2
- package/lib/relay-hooks/useRefetchableFragmentNode.js +1 -2
- package/lib/relay-hooks/useRelayEnvironment.js +0 -1
- package/lib/relay-hooks/useStaticFragmentNodeWarning.js +0 -1
- package/lib/relay-hooks/useSubscribeToInvalidationState.js +0 -1
- package/lib/relay-hooks/useSubscription.js +0 -1
- package/multi-actor/useRelayActorEnvironment.js.flow +0 -2
- package/package.json +2 -2
- package/react-relay-hooks.js +2 -2
- package/react-relay-hooks.min.js +2 -2
- package/react-relay-legacy.js +2 -2
- package/react-relay-legacy.min.js +2 -2
- package/react-relay.js +2 -2
- package/react-relay.min.js +2 -2
- package/readContext.js.flow +0 -2
- package/relay-hooks/EntryPointContainer.react.js.flow +2 -4
- package/relay-hooks/EntryPointTypes.flow.js.flow +30 -32
- package/relay-hooks/FragmentResource.js.flow +9 -11
- package/relay-hooks/HooksImplementation.js.flow +6 -8
- package/relay-hooks/InternalLogger.js.flow +0 -2
- package/relay-hooks/LRUCache.js.flow +0 -2
- package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +4 -6
- package/relay-hooks/MatchContainer.js.flow +5 -7
- package/relay-hooks/ProfilerContext.js.flow +0 -2
- package/relay-hooks/QueryResource.js.flow +4 -6
- package/relay-hooks/RelayEnvironmentProvider.js.flow +2 -4
- package/relay-hooks/SuspenseResource.js.flow +0 -2
- package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +3 -3
- package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +2 -2
- package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +4 -6
- package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +0 -2
- package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +4 -6
- package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +0 -2
- package/relay-hooks/__flowtests__/utils.js.flow +8 -10
- package/relay-hooks/preloadQuery_DEPRECATED.js.flow +4 -6
- package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +0 -2
- package/relay-hooks/react-cache/RelayReactCache.js.flow +0 -2
- package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +22 -16
- package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +297 -0
- package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +134 -94
- package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +0 -2
- package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +2 -4
- package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +171 -0
- package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +2 -4
- package/relay-hooks/react-cache/useRefetchableFragmentInternal_REACT_CACHE.js.flow +595 -0
- package/relay-hooks/react-cache/useRefetchableFragment_REACT_CACHE.js.flow +65 -0
- package/relay-hooks/useBlockingPaginationFragment.js.flow +4 -6
- package/relay-hooks/useClientQuery.js.flow +39 -0
- package/relay-hooks/useEntryPointLoader.js.flow +6 -8
- package/relay-hooks/useFetchTrackingRef.js.flow +2 -4
- package/relay-hooks/useFragment.js.flow +0 -2
- package/relay-hooks/useFragmentNode.js.flow +2 -4
- package/relay-hooks/useIsMountedRef.js.flow +1 -3
- package/relay-hooks/useLazyLoadQuery.js.flow +7 -30
- package/relay-hooks/useLazyLoadQueryNode.js.flow +2 -4
- package/relay-hooks/useLoadMoreFunction.js.flow +6 -8
- package/relay-hooks/useMemoOperationDescriptor.js.flow +0 -2
- package/relay-hooks/useMemoVariables.js.flow +0 -2
- package/relay-hooks/useMutation.js.flow +2 -4
- package/relay-hooks/usePaginationFragment.js.flow +44 -19
- package/relay-hooks/usePreloadedQuery.js.flow +5 -24
- package/relay-hooks/useQueryLoader.js.flow +4 -6
- package/relay-hooks/useRefetchableFragment.js.flow +32 -3
- package/relay-hooks/useRefetchableFragmentNode.js.flow +16 -18
- package/relay-hooks/useRelayEnvironment.js.flow +0 -2
- package/relay-hooks/useStaticFragmentNodeWarning.js.flow +0 -2
- package/relay-hooks/useSubscribeToInvalidationState.js.flow +0 -2
- 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
|
49
|
+
var _class;
|
49
50
|
|
50
51
|
var containerName = getContainerName(Component);
|
51
|
-
return
|
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
|
172
|
+
var key = keys[ii];
|
172
173
|
|
173
|
-
if (
|
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(
|
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,
|
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),
|
237
|
+
}(React.Component), (0, _defineProperty2["default"])(_class, "displayName", containerName), _class;
|
237
238
|
}
|
238
239
|
|
239
240
|
function getRelayProp(environment) {
|
@@ -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
|
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
|
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
|
468
|
+
var key = keys[ii];
|
466
469
|
|
467
|
-
if (
|
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(
|
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,
|
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,
|
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,
|
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),
|
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,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
|
63
|
+
var _class;
|
63
64
|
|
64
65
|
var containerName = getContainerName(Component);
|
65
|
-
return
|
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
|
-
|
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
|
304
|
+
var key = keys[ii];
|
308
305
|
|
309
|
-
if (
|
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(
|
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,
|
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),
|
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
|
|
package/lib/ReactRelayTypes.js
CHANGED
package/lib/RelayContext.js
CHANGED
package/lib/assertFragmentMap.js
CHANGED
@@ -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
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,
|
package/lib/legacy.js
CHANGED
package/lib/readContext.js
CHANGED
@@ -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))
|
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
|
443
|
-
result[
|
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
|
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,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,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
|
|