react-relay 12.0.0 → 13.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +47 -0
- package/ReactRelayContainerUtils.js.flow +1 -1
- package/ReactRelayContext.js +2 -2
- package/ReactRelayContext.js.flow +3 -4
- package/ReactRelayFragmentContainer.js.flow +11 -17
- package/ReactRelayFragmentMockRenderer.js.flow +2 -2
- package/ReactRelayLocalQueryRenderer.js.flow +7 -8
- package/ReactRelayPaginationContainer.js.flow +30 -40
- package/ReactRelayQueryFetcher.js.flow +10 -11
- package/ReactRelayQueryRenderer.js.flow +16 -16
- package/ReactRelayQueryRendererContext.js.flow +1 -1
- package/ReactRelayRefetchContainer.js.flow +25 -33
- package/ReactRelayTestMocker.js.flow +17 -15
- package/ReactRelayTypes.js.flow +11 -11
- package/RelayContext.js.flow +4 -4
- package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -3
- package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +2 -3
- package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +2 -3
- package/__flowtests__/RelayModern-flowtest.js.flow +79 -47
- package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +6 -5
- package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +6 -5
- package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +5 -4
- package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +5 -4
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +14 -11
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +14 -11
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +14 -9
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +14 -11
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +14 -9
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +14 -11
- package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +16 -13
- package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +16 -13
- package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +14 -11
- package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +14 -11
- package/assertFragmentMap.js.flow +3 -3
- package/buildReactRelayContainer.js.flow +12 -11
- package/getRootVariablesForFragments.js.flow +3 -5
- package/hooks.js +2 -2
- package/hooks.js.flow +4 -6
- package/index.js +2 -2
- package/index.js.flow +5 -7
- package/isRelayEnvironment.js.flow +1 -1
- package/jest-react/enqueueTask.js.flow +2 -2
- package/jest-react/index.js.flow +1 -1
- package/jest-react/internalAct.js.flow +2 -4
- package/legacy.js +2 -2
- package/legacy.js.flow +1 -1
- package/lib/ReactRelayContainerUtils.js +1 -1
- package/lib/ReactRelayContext.js +1 -1
- package/lib/ReactRelayFragmentContainer.js +5 -5
- package/lib/ReactRelayFragmentMockRenderer.js +3 -3
- package/lib/ReactRelayLocalQueryRenderer.js +8 -9
- package/lib/ReactRelayPaginationContainer.js +19 -23
- package/lib/ReactRelayQueryFetcher.js +3 -3
- package/lib/ReactRelayQueryRenderer.js +5 -5
- package/lib/ReactRelayQueryRendererContext.js +1 -1
- package/lib/ReactRelayRefetchContainer.js +13 -15
- package/lib/ReactRelayTestMocker.js +8 -9
- package/lib/ReactRelayTypes.js +1 -1
- package/lib/RelayContext.js +4 -3
- package/lib/assertFragmentMap.js +3 -2
- package/lib/buildReactRelayContainer.js +8 -8
- package/lib/getRootVariablesForFragments.js +2 -3
- package/lib/hooks.js +6 -6
- package/lib/index.js +8 -8
- package/lib/isRelayEnvironment.js +1 -1
- package/lib/jest-react/enqueueTask.js +1 -1
- package/lib/jest-react/internalAct.js +3 -4
- package/lib/legacy.js +1 -1
- package/lib/multi-actor/ActorChange.js +3 -3
- package/lib/multi-actor/index.js +1 -1
- package/lib/multi-actor/useRelayActorEnvironment.js +3 -3
- package/lib/readContext.js +1 -1
- package/lib/relay-hooks/EntryPointContainer.react.js +4 -4
- package/lib/relay-hooks/EntryPointTypes.flow.js +1 -1
- package/lib/relay-hooks/FragmentResource.js +242 -46
- package/lib/relay-hooks/InternalLogger.js +1 -1
- package/lib/relay-hooks/LRUCache.js +1 -1
- package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +5 -5
- package/lib/relay-hooks/MatchContainer.js +2 -2
- package/lib/relay-hooks/ProfilerContext.js +1 -1
- package/lib/relay-hooks/QueryResource.js +84 -5
- package/lib/relay-hooks/RelayEnvironmentProvider.js +1 -1
- package/lib/relay-hooks/SuspenseResource.js +130 -0
- package/lib/relay-hooks/loadEntryPoint.js +1 -1
- package/lib/relay-hooks/loadQuery.js +9 -10
- package/lib/relay-hooks/preloadQuery_DEPRECATED.js +25 -11
- package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +1 -1
- package/lib/relay-hooks/useBlockingPaginationFragment.js +3 -3
- package/lib/relay-hooks/useEntryPointLoader.js +3 -3
- package/lib/relay-hooks/useFetchTrackingRef.js +3 -2
- package/lib/relay-hooks/useFragment.js +7 -7
- package/lib/relay-hooks/useFragmentNode.js +5 -5
- package/lib/relay-hooks/useIsMountedRef.js +1 -1
- package/lib/relay-hooks/useIsOperationNodeActive.js +3 -3
- package/lib/relay-hooks/useIsParentQueryActive.js +1 -1
- package/lib/relay-hooks/useLazyLoadQuery.js +4 -4
- package/lib/relay-hooks/useLazyLoadQueryNode.js +5 -5
- package/lib/relay-hooks/useLoadMoreFunction.js +8 -10
- package/lib/relay-hooks/useMemoOperationDescriptor.js +3 -3
- package/lib/relay-hooks/useMemoVariables.js +3 -3
- package/lib/relay-hooks/useMutation.js +18 -7
- package/lib/relay-hooks/usePaginationFragment.js +1 -1
- package/lib/relay-hooks/usePreloadedQuery.js +6 -6
- package/lib/relay-hooks/useQueryLoader.js +5 -5
- package/lib/relay-hooks/useRefetchableFragment.js +1 -1
- package/lib/relay-hooks/useRefetchableFragmentNode.js +11 -13
- package/lib/relay-hooks/useRelayEnvironment.js +3 -3
- package/lib/relay-hooks/useStaticFragmentNodeWarning.js +3 -3
- package/lib/relay-hooks/useSubscribeToInvalidationState.js +3 -2
- package/lib/relay-hooks/useSubscription.js +1 -1
- package/multi-actor/ActorChange.js.flow +4 -5
- package/multi-actor/index.js.flow +1 -1
- package/multi-actor/useRelayActorEnvironment.js.flow +6 -8
- package/package.json +3 -3
- package/react-relay-hooks.js +2 -2
- package/react-relay-hooks.min.js +3 -3
- package/react-relay-legacy.js +2 -2
- package/react-relay-legacy.min.js +3 -3
- package/react-relay.js +2 -2
- package/react-relay.min.js +3 -3
- package/readContext.js.flow +1 -1
- package/relay-hooks/EntryPointContainer.react.js.flow +9 -16
- package/relay-hooks/EntryPointTypes.flow.js.flow +19 -25
- package/relay-hooks/FragmentResource.js.flow +221 -35
- package/relay-hooks/InternalLogger.js.flow +1 -1
- package/relay-hooks/LRUCache.js.flow +1 -1
- package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +33 -47
- package/relay-hooks/MatchContainer.js.flow +4 -3
- package/relay-hooks/ProfilerContext.js.flow +1 -1
- package/relay-hooks/QueryResource.js.flow +120 -18
- package/relay-hooks/RelayEnvironmentProvider.js.flow +10 -10
- package/relay-hooks/SuspenseResource.js.flow +115 -0
- package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +5 -4
- package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +2 -2
- package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_user.graphql.js.flow +59 -0
- package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.js.flow +61 -0
- package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +11 -10
- package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +55 -32
- package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +11 -10
- package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +11 -10
- package/relay-hooks/__flowtests__/utils.js.flow +21 -32
- package/relay-hooks/loadEntryPoint.js.flow +7 -13
- package/relay-hooks/loadQuery.js.flow +23 -24
- package/relay-hooks/preloadQuery_DEPRECATED.js.flow +30 -14
- package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +7 -13
- package/relay-hooks/useBlockingPaginationFragment.js.flow +13 -14
- package/relay-hooks/useEntryPointLoader.js.flow +8 -11
- package/relay-hooks/useFetchTrackingRef.js.flow +3 -3
- package/relay-hooks/useFragment.js.flow +31 -62
- package/relay-hooks/useFragmentNode.js.flow +6 -8
- package/relay-hooks/useIsMountedRef.js.flow +1 -1
- package/relay-hooks/useIsOperationNodeActive.js.flow +4 -6
- package/relay-hooks/useIsParentQueryActive.js.flow +4 -5
- package/relay-hooks/useLazyLoadQuery.js.flow +14 -16
- package/relay-hooks/useLazyLoadQueryNode.js.flow +12 -14
- package/relay-hooks/useLoadMoreFunction.js.flow +20 -28
- package/relay-hooks/useMemoOperationDescriptor.js.flow +6 -8
- package/relay-hooks/useMemoVariables.js.flow +7 -7
- package/relay-hooks/useMutation.js.flow +27 -27
- package/relay-hooks/usePaginationFragment.js.flow +38 -47
- package/relay-hooks/usePreloadedQuery.js.flow +14 -20
- package/relay-hooks/useQueryLoader.js.flow +14 -17
- package/relay-hooks/useRefetchableFragment.js.flow +8 -9
- package/relay-hooks/useRefetchableFragmentNode.js.flow +23 -31
- package/relay-hooks/useRelayEnvironment.js.flow +3 -5
- package/relay-hooks/useStaticFragmentNodeWarning.js.flow +3 -4
- package/relay-hooks/useSubscribeToInvalidationState.js.flow +4 -7
- package/relay-hooks/useSubscription.js.flow +7 -8
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -24,39 +24,39 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
24
24
|
|
25
25
|
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
26
26
|
|
27
|
-
var React = require('react');
|
28
|
-
|
29
|
-
var ReactRelayContext = require('./ReactRelayContext');
|
30
|
-
|
31
|
-
var ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
|
32
|
-
|
33
|
-
var areEqual = require("fbjs/lib/areEqual");
|
34
|
-
|
35
27
|
var buildReactRelayContainer = require('./buildReactRelayContainer');
|
36
28
|
|
37
29
|
var getRootVariablesForFragments = require('./getRootVariablesForFragments');
|
38
30
|
|
39
|
-
var invariant = require('invariant');
|
40
|
-
|
41
|
-
var warning = require("fbjs/lib/warning");
|
42
|
-
|
43
31
|
var _require = require('./ReactRelayContainerUtils'),
|
44
32
|
getComponentName = _require.getComponentName,
|
45
33
|
getContainerName = _require.getContainerName;
|
46
34
|
|
35
|
+
var ReactRelayContext = require('./ReactRelayContext');
|
36
|
+
|
37
|
+
var ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
|
38
|
+
|
47
39
|
var _require2 = require('./RelayContext'),
|
48
40
|
assertRelayContext = _require2.assertRelayContext;
|
49
41
|
|
42
|
+
var areEqual = require("fbjs/lib/areEqual");
|
43
|
+
|
44
|
+
var invariant = require('invariant');
|
45
|
+
|
46
|
+
var React = require('react');
|
47
|
+
|
50
48
|
var _require3 = require('relay-runtime'),
|
51
49
|
ConnectionInterface = _require3.ConnectionInterface,
|
52
50
|
Observable = _require3.Observable,
|
51
|
+
RelayFeatureFlags = _require3.RelayFeatureFlags,
|
53
52
|
createFragmentSpecResolver = _require3.createFragmentSpecResolver,
|
54
53
|
createOperationDescriptor = _require3.createOperationDescriptor,
|
55
54
|
getDataIDsFromObject = _require3.getDataIDsFromObject,
|
56
55
|
getRequest = _require3.getRequest,
|
57
56
|
getVariablesFromObject = _require3.getVariablesFromObject,
|
58
|
-
isScalarAndEqual = _require3.isScalarAndEqual
|
59
|
-
|
57
|
+
isScalarAndEqual = _require3.isScalarAndEqual;
|
58
|
+
|
59
|
+
var warning = require("fbjs/lib/warning");
|
60
60
|
|
61
61
|
var FORWARD = 'forward';
|
62
62
|
|
@@ -211,8 +211,7 @@ function createGetConnectionFromProps(metadata) {
|
|
211
211
|
|
212
212
|
function createGetFragmentVariables(metadata) {
|
213
213
|
var countVariable = metadata.count;
|
214
|
-
!countVariable ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Unable to synthesize a ' + 'getFragmentVariables function.') : invariant(false) : void 0;
|
215
|
-
|
214
|
+
!countVariable ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Unable to synthesize a ' + 'getFragmentVariables function.') : invariant(false) : void 0;
|
216
215
|
return function (prevVars, totalCount) {
|
217
216
|
return (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, prevVars), {}, (0, _defineProperty2["default"])({}, countVariable, totalCount));
|
218
217
|
};
|
@@ -599,17 +598,14 @@ function createContainerWithFragments(Component, fragments, connectionConfig) {
|
|
599
598
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props2, ["componentRef", "__relayContext", "__rootIsQueryRenderer"]);
|
600
599
|
var props = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, restProps), this.state.data);
|
601
600
|
var fragmentVariables;
|
602
|
-
var rootVariables = getRootVariablesForFragments(fragments, restProps);
|
603
|
-
|
604
|
-
fragmentVariables = getVariablesFromObject(fragments, restProps); // $FlowFixMe[cannot-spread-interface]
|
605
|
-
|
601
|
+
var rootVariables = getRootVariablesForFragments(fragments, restProps);
|
602
|
+
fragmentVariables = getVariablesFromObject(fragments, restProps);
|
606
603
|
fragmentVariables = (0, _objectSpread3["default"])((0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, rootVariables), fragmentVariables), this._refetchVariables);
|
607
604
|
var fetchVariables = connectionConfig.getVariables(props, {
|
608
605
|
count: paginatingVariables.count,
|
609
606
|
cursor: paginatingVariables.cursor
|
610
607
|
}, fragmentVariables);
|
611
|
-
!(typeof fetchVariables === 'object' && fetchVariables !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Expected `getVariables()` to ' + 'return an object, got `%s` in `%s`.', fetchVariables, componentName) : invariant(false) : void 0;
|
612
|
-
|
608
|
+
!(typeof fetchVariables === 'object' && fetchVariables !== null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'ReactRelayPaginationContainer: Expected `getVariables()` to ' + 'return an object, got `%s` in `%s`.', fetchVariables, componentName) : invariant(false) : void 0;
|
613
609
|
fetchVariables = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, fetchVariables), this._refetchVariables);
|
614
610
|
fragmentVariables = (0, _objectSpread3["default"])((0, _objectSpread3["default"])({}, fetchVariables), fragmentVariables);
|
615
611
|
var cacheConfig = options ? {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -17,9 +17,9 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
17
17
|
var invariant = require('invariant');
|
18
18
|
|
19
19
|
var _require = require('relay-runtime'),
|
20
|
+
fetchQuery = _require.__internal.fetchQuery,
|
20
21
|
createOperationDescriptor = _require.createOperationDescriptor,
|
21
|
-
isRelayModernEnvironment = _require.isRelayModernEnvironment
|
22
|
-
fetchQuery = _require.__internal.fetchQuery;
|
22
|
+
isRelayModernEnvironment = _require.isRelayModernEnvironment;
|
23
23
|
|
24
24
|
var ReactRelayQueryFetcher = /*#__PURE__*/function () {
|
25
25
|
function ReactRelayQueryFetcher(args) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -20,8 +20,6 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
20
20
|
|
21
21
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
22
22
|
|
23
|
-
var React = require('react');
|
24
|
-
|
25
23
|
var ReactRelayContext = require('./ReactRelayContext');
|
26
24
|
|
27
25
|
var ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
|
@@ -30,11 +28,13 @@ var ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext')
|
|
30
28
|
|
31
29
|
var areEqual = require("fbjs/lib/areEqual");
|
32
30
|
|
31
|
+
var React = require('react');
|
32
|
+
|
33
33
|
var _require = require('relay-runtime'),
|
34
|
+
RelayFeatureFlags = _require.RelayFeatureFlags,
|
34
35
|
createOperationDescriptor = _require.createOperationDescriptor,
|
35
36
|
deepFreeze = _require.deepFreeze,
|
36
|
-
getRequest = _require.getRequest
|
37
|
-
RelayFeatureFlags = _require.RelayFeatureFlags;
|
37
|
+
getRequest = _require.getRequest;
|
38
38
|
|
39
39
|
/**
|
40
40
|
* React may double-fire the constructor, and we call 'fetch' in the
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -24,26 +24,24 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
24
24
|
|
25
25
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
26
26
|
|
27
|
-
var React = require('react');
|
28
|
-
|
29
|
-
var ReactRelayContext = require('./ReactRelayContext');
|
30
|
-
|
31
|
-
var ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
|
32
|
-
|
33
|
-
var areEqual = require("fbjs/lib/areEqual");
|
34
|
-
|
35
27
|
var buildReactRelayContainer = require('./buildReactRelayContainer');
|
36
28
|
|
37
29
|
var getRootVariablesForFragments = require('./getRootVariablesForFragments');
|
38
30
|
|
39
|
-
var warning = require("fbjs/lib/warning");
|
40
|
-
|
41
31
|
var _require = require('./ReactRelayContainerUtils'),
|
42
32
|
getContainerName = _require.getContainerName;
|
43
33
|
|
34
|
+
var ReactRelayContext = require('./ReactRelayContext');
|
35
|
+
|
36
|
+
var ReactRelayQueryFetcher = require('./ReactRelayQueryFetcher');
|
37
|
+
|
44
38
|
var _require2 = require('./RelayContext'),
|
45
39
|
assertRelayContext = _require2.assertRelayContext;
|
46
40
|
|
41
|
+
var areEqual = require("fbjs/lib/areEqual");
|
42
|
+
|
43
|
+
var React = require('react');
|
44
|
+
|
47
45
|
var _require3 = require('relay-runtime'),
|
48
46
|
Observable = _require3.Observable,
|
49
47
|
createFragmentSpecResolver = _require3.createFragmentSpecResolver,
|
@@ -53,6 +51,8 @@ var _require3 = require('relay-runtime'),
|
|
53
51
|
getVariablesFromObject = _require3.getVariablesFromObject,
|
54
52
|
isScalarAndEqual = _require3.isScalarAndEqual;
|
55
53
|
|
54
|
+
var warning = require("fbjs/lib/warning");
|
55
|
+
|
56
56
|
/**
|
57
57
|
* Composes a React component class, returning a new class that intercepts
|
58
58
|
* props, resolving them with the provided fragments and subscribing for
|
@@ -93,11 +93,9 @@ function createContainerWithFragments(Component, fragments, taggedNode) {
|
|
93
93
|
environment = _assertRelayContext.environment;
|
94
94
|
|
95
95
|
var rootVariables = getRootVariablesForFragments(fragments, _this.props);
|
96
|
-
var fetchVariables = typeof refetchVariables === 'function' ? refetchVariables(_this._getFragmentVariables()) : refetchVariables;
|
97
|
-
|
96
|
+
var fetchVariables = typeof refetchVariables === 'function' ? refetchVariables(_this._getFragmentVariables()) : refetchVariables;
|
98
97
|
fetchVariables = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, rootVariables), fetchVariables);
|
99
|
-
var fragmentVariables = renderVariables ?
|
100
|
-
(0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fetchVariables), renderVariables) : fetchVariables;
|
98
|
+
var fragmentVariables = renderVariables ? (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, fetchVariables), renderVariables) : fetchVariables;
|
101
99
|
var cacheConfig = options ? {
|
102
100
|
force: !!options.force
|
103
101
|
} : undefined;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -20,12 +20,12 @@ var areEqual = require("fbjs/lib/areEqual");
|
|
20
20
|
|
21
21
|
var invariant = require('invariant');
|
22
22
|
|
23
|
-
var warning = require("fbjs/lib/warning");
|
24
|
-
|
25
23
|
var _require = require('relay-runtime'),
|
24
|
+
Network = _require.Network,
|
26
25
|
createOperationDescriptor = _require.createOperationDescriptor,
|
27
|
-
isRelayModernEnvironment = _require.isRelayModernEnvironment
|
28
|
-
|
26
|
+
isRelayModernEnvironment = _require.isRelayModernEnvironment;
|
27
|
+
|
28
|
+
var warning = require("fbjs/lib/warning");
|
29
29
|
|
30
30
|
/**
|
31
31
|
* The next id to return from `generateId()`.
|
@@ -83,10 +83,8 @@ var ReactRelayTestMocker = /*#__PURE__*/function () {
|
|
83
83
|
;
|
84
84
|
|
85
85
|
ReactRelayTestMocker.stripUnused = function stripUnused(variables) {
|
86
|
-
// $FlowFixMe[prop-missing]
|
87
86
|
if (variables.input) {
|
88
|
-
var toRemove = ['client_mutation_id', 'actor_id', 'clientMutationId', 'actorId'];
|
89
|
-
|
87
|
+
var toRemove = ['client_mutation_id', 'actor_id', 'clientMutationId', 'actorId'];
|
90
88
|
var strippedVariables = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, variables), {}, {
|
91
89
|
input: (0, _objectSpread2["default"])({}, variables.input)
|
92
90
|
});
|
@@ -258,7 +256,8 @@ var ReactRelayTestMocker = /*#__PURE__*/function () {
|
|
258
256
|
|
259
257
|
var varMessage = usedVars ? ' - variables: ' + JSON.stringify(usedVars) : '';
|
260
258
|
!toResolve ? process.env.NODE_ENV !== "production" ? invariant(false, 'You are attempting to resolve a query that has not been fetched ' + '(%s%s).\n\tPlease ensure you passed the correct variables, or use ' + '`writeDirect` instead.', ident, varMessage) : invariant(false) : void 0;
|
261
|
-
var realPayload =
|
259
|
+
var realPayload = // $FlowFixMe[incompatible-call]
|
260
|
+
typeof payload === 'function' ? payload(toResolve.variables) : payload; // if there are errors, reject the query
|
262
261
|
|
263
262
|
if (realPayload.errors != null && realPayload.errors.length > 0) {
|
264
263
|
this._environment.mock.rejectQuery(toResolve, {
|
package/lib/ReactRelayTypes.js
CHANGED
package/lib/RelayContext.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -10,14 +10,15 @@
|
|
10
10
|
// flowlint ambiguous-object-type:error
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
var invariant = require('invariant');
|
14
|
-
|
15
13
|
var isRelayEnvironment = require('./isRelayEnvironment');
|
16
14
|
|
15
|
+
var invariant = require('invariant');
|
17
16
|
/**
|
18
17
|
* Asserts that the input is a matches the `RelayContext` type defined in
|
19
18
|
* `RelayEnvironmentTypes` and returns it as that type.
|
20
19
|
*/
|
20
|
+
|
21
|
+
|
21
22
|
function assertRelayContext(relay) {
|
22
23
|
!isRelayContext(relay) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayContext: Expected `context.relay` to be an object conforming to ' + 'the `RelayContext` interface, got `%s`.', relay) : invariant(false) : void 0;
|
23
24
|
return relay;
|
package/lib/assertFragmentMap.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -11,10 +11,11 @@
|
|
11
11
|
'use strict';
|
12
12
|
|
13
13
|
var invariant = require('invariant');
|
14
|
-
|
15
14
|
/**
|
16
15
|
* Fail fast if the user supplies invalid fragments as input.
|
17
16
|
*/
|
17
|
+
|
18
|
+
|
18
19
|
function assertFragmentMap(componentName, fragmentSpec) {
|
19
20
|
!(fragmentSpec && typeof fragmentSpec === 'object') ? process.env.NODE_ENV !== "production" ? invariant(false, 'Could not create Relay Container for `%s`. ' + 'Expected a set of GraphQL fragments, got `%s` instead.', componentName, fragmentSpec) : invariant(false) : void 0;
|
20
21
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -14,21 +14,21 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
14
14
|
|
15
15
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
16
16
|
|
17
|
-
var
|
17
|
+
var assertFragmentMap = require('./assertFragmentMap');
|
18
|
+
|
19
|
+
var _require = require('./ReactRelayContainerUtils'),
|
20
|
+
getComponentName = _require.getComponentName,
|
21
|
+
getContainerName = _require.getContainerName;
|
18
22
|
|
19
23
|
var ReactRelayContext = require('./ReactRelayContext');
|
20
24
|
|
21
25
|
var ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext');
|
22
26
|
|
23
|
-
var
|
27
|
+
var readContext = require('./readContext');
|
24
28
|
|
25
29
|
var invariant = require('invariant');
|
26
30
|
|
27
|
-
var
|
28
|
-
|
29
|
-
var _require = require('./ReactRelayContainerUtils'),
|
30
|
-
getComponentName = _require.getComponentName,
|
31
|
-
getContainerName = _require.getContainerName;
|
31
|
+
var React = require('react');
|
32
32
|
|
33
33
|
var _require2 = require('relay-runtime'),
|
34
34
|
getFragment = _require2.getFragment;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -28,8 +28,7 @@ function getRootVariablesForFragments(fragments, props) {
|
|
28
28
|
var fragmentNode = fragments[key];
|
29
29
|
var fragmentRef = props[key];
|
30
30
|
var selector = getSelector(fragmentNode, fragmentRef);
|
31
|
-
var fragmentOwnerVariables = selector != null && selector.kind === 'PluralReaderSelector' ? (_selector$selectors$ = (_selector$selectors$2 = selector.selectors[0]) === null || _selector$selectors$2 === void 0 ? void 0 : _selector$selectors$2.owner.variables) !== null && _selector$selectors$ !== void 0 ? _selector$selectors$ : {} : (_selector$owner$varia = selector === null || selector === void 0 ? void 0 : selector.owner.variables) !== null && _selector$owner$varia !== void 0 ? _selector$owner$varia : {};
|
32
|
-
|
31
|
+
var fragmentOwnerVariables = selector != null && selector.kind === 'PluralReaderSelector' ? (_selector$selectors$ = (_selector$selectors$2 = selector.selectors[0]) === null || _selector$selectors$2 === void 0 ? void 0 : _selector$selectors$2.owner.variables) !== null && _selector$selectors$ !== void 0 ? _selector$selectors$ : {} : (_selector$owner$varia = selector === null || selector === void 0 ? void 0 : selector.owner.variables) !== null && _selector$owner$varia !== void 0 ? _selector$owner$varia : {};
|
33
32
|
rootVariables = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, rootVariables), fragmentOwnerVariables);
|
34
33
|
});
|
35
34
|
return rootVariables;
|
package/lib/hooks.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -12,11 +12,12 @@
|
|
12
12
|
|
13
13
|
var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
14
14
|
|
15
|
-
var
|
15
|
+
var loadEntryPoint = require('./relay-hooks/loadEntryPoint');
|
16
16
|
|
17
|
-
var
|
17
|
+
var _require = require('./relay-hooks/loadQuery'),
|
18
|
+
loadQuery = _require.loadQuery;
|
18
19
|
|
19
|
-
var
|
20
|
+
var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
20
21
|
|
21
22
|
var useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
|
22
23
|
|
@@ -40,8 +41,7 @@ var useSubscribeToInvalidationState = require('./relay-hooks/useSubscribeToInval
|
|
40
41
|
|
41
42
|
var useSubscription = require('./relay-hooks/useSubscription');
|
42
43
|
|
43
|
-
var
|
44
|
-
loadQuery = _require.loadQuery;
|
44
|
+
var RelayRuntime = require('relay-runtime');
|
45
45
|
|
46
46
|
/**
|
47
47
|
* The public interface for Relay Hooks.
|
package/lib/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -10,8 +10,6 @@
|
|
10
10
|
// flowlint ambiguous-object-type:error
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
14
|
-
|
15
13
|
var ReactRelayContext = require('./ReactRelayContext');
|
16
14
|
|
17
15
|
var ReactRelayFragmentContainer = require('./ReactRelayFragmentContainer');
|
@@ -24,12 +22,15 @@ var ReactRelayQueryRenderer = require('./ReactRelayQueryRenderer');
|
|
24
22
|
|
25
23
|
var ReactRelayRefetchContainer = require('./ReactRelayRefetchContainer');
|
26
24
|
|
27
|
-
var
|
28
|
-
|
29
|
-
var RelayRuntime = require('relay-runtime');
|
25
|
+
var EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
30
26
|
|
31
27
|
var loadEntryPoint = require('./relay-hooks/loadEntryPoint');
|
32
28
|
|
29
|
+
var _require = require('./relay-hooks/loadQuery'),
|
30
|
+
loadQuery = _require.loadQuery;
|
31
|
+
|
32
|
+
var RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
33
|
+
|
33
34
|
var useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
|
34
35
|
|
35
36
|
var useFragment = require('./relay-hooks/useFragment');
|
@@ -52,8 +53,7 @@ var useSubscribeToInvalidationState = require('./relay-hooks/useSubscribeToInval
|
|
52
53
|
|
53
54
|
var useSubscription = require('./relay-hooks/useSubscription');
|
54
55
|
|
55
|
-
var
|
56
|
-
loadQuery = _require.loadQuery;
|
56
|
+
var RelayRuntime = require('relay-runtime');
|
57
57
|
|
58
58
|
/**
|
59
59
|
* The public interface to react-relay.
|
@@ -1,12 +1,11 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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
7
|
* @emails oncall+relay
|
8
8
|
* @format
|
9
|
-
*
|
10
9
|
*/
|
11
10
|
|
12
11
|
/* global jest */
|
@@ -19,9 +18,9 @@
|
|
19
18
|
// building an app with React.
|
20
19
|
'use strict';
|
21
20
|
|
22
|
-
var
|
21
|
+
var enqueueTask = require('./enqueueTask');
|
23
22
|
|
24
|
-
var
|
23
|
+
var Scheduler = require('scheduler/unstable_mock'); // The subset of a Promise that React APIs rely on. This resolves a value.
|
25
24
|
// This doesn't require a return value neither from the handler nor the
|
26
25
|
// then function.
|
27
26
|
|
package/lib/legacy.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -10,12 +10,12 @@
|
|
10
10
|
*/
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
var React = require('react');
|
14
|
-
|
15
13
|
var RelayEnvironmentProvider = require('../relay-hooks/RelayEnvironmentProvider');
|
16
14
|
|
17
15
|
var useRelayActorEnvironment = require('./useRelayActorEnvironment');
|
18
16
|
|
17
|
+
var React = require('react');
|
18
|
+
|
19
19
|
function ActorChange(props) {
|
20
20
|
var actorEnvironment = useRelayActorEnvironment(props.actorChangePoint.__viewer);
|
21
21
|
var getEnvironmentForActor = React.useCallback(function (actorIdentifier) {
|
package/lib/multi-actor/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -11,13 +11,13 @@
|
|
11
11
|
// flowlint ambiguous-object-type:error
|
12
12
|
'use strict';
|
13
13
|
|
14
|
-
var ReactRelayContext = require('react-relay/ReactRelayContext');
|
15
|
-
|
16
14
|
var invariant = require('invariant');
|
17
15
|
|
18
16
|
var _require = require('react'),
|
19
17
|
useContext = _require.useContext;
|
20
18
|
|
19
|
+
var ReactRelayContext = require('react-relay/ReactRelayContext');
|
20
|
+
|
21
21
|
function useRelayActorEnvironment(actorIdentifier) {
|
22
22
|
var context = useContext(ReactRelayContext);
|
23
23
|
!(context != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'useRelayActorEnvironment: Expected to have found a Relay environment provided by ' + 'a `RelayEnvironmentProvider` component. ' + 'This usually means that useRelayActorEnvironment was used in a ' + 'component that is not a descendant of a `RelayEnvironmentProvider`. ' + 'Please make sure a `RelayEnvironmentProvider` has been rendered somewhere ' + 'as a parent or ancestor of your component.') : invariant(false) : void 0;
|
package/lib/readContext.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* Copyright (c)
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
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.
|
@@ -13,16 +13,16 @@
|
|
13
13
|
|
14
14
|
var ProfilerContext = require('./ProfilerContext');
|
15
15
|
|
16
|
-
var React = require('react');
|
17
|
-
|
18
16
|
var useRelayEnvironment = require('./useRelayEnvironment');
|
19
17
|
|
20
|
-
var
|
18
|
+
var React = require('react');
|
21
19
|
|
22
20
|
var _require = require('react'),
|
23
21
|
useContext = _require.useContext,
|
24
22
|
useEffect = _require.useEffect;
|
25
23
|
|
24
|
+
var warning = require("fbjs/lib/warning");
|
25
|
+
|
26
26
|
function EntryPointContainer(_ref) {
|
27
27
|
var entryPointReference = _ref.entryPointReference,
|
28
28
|
props = _ref.props;
|