react-relay 12.0.0 → 13.0.0-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ReactRelayContext.js +1 -1
- package/ReactRelayContext.js.flow +2 -3
- package/ReactRelayFragmentContainer.js.flow +10 -16
- package/ReactRelayFragmentMockRenderer.js.flow +1 -1
- package/ReactRelayLocalQueryRenderer.js.flow +6 -7
- package/ReactRelayPaginationContainer.js.flow +29 -39
- package/ReactRelayQueryFetcher.js.flow +9 -10
- package/ReactRelayQueryRenderer.js.flow +15 -15
- package/ReactRelayRefetchContainer.js.flow +24 -32
- package/ReactRelayTestMocker.js.flow +16 -14
- package/ReactRelayTypes.js.flow +10 -10
- package/RelayContext.js.flow +3 -3
- package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +1 -2
- package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +1 -2
- package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +1 -2
- package/__flowtests__/RelayModern-flowtest.js.flow +78 -46
- package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +5 -4
- package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +5 -4
- package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +4 -3
- package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +4 -3
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +13 -10
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +13 -10
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +13 -8
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +13 -10
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +13 -8
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +13 -10
- package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +15 -12
- package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +15 -12
- package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +13 -10
- package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +13 -10
- package/assertFragmentMap.js.flow +2 -2
- package/buildReactRelayContainer.js.flow +11 -10
- package/getRootVariablesForFragments.js.flow +2 -4
- package/hooks.js +1 -1
- package/hooks.js.flow +3 -5
- package/index.js +1 -1
- package/index.js.flow +4 -6
- package/jest-react/enqueueTask.js.flow +1 -1
- package/jest-react/internalAct.js.flow +1 -2
- package/legacy.js +1 -1
- package/lib/ReactRelayFragmentContainer.js +4 -4
- package/lib/ReactRelayFragmentMockRenderer.js +2 -2
- package/lib/ReactRelayLocalQueryRenderer.js +7 -8
- package/lib/ReactRelayPaginationContainer.js +18 -22
- package/lib/ReactRelayQueryFetcher.js +2 -2
- package/lib/ReactRelayQueryRenderer.js +4 -4
- package/lib/ReactRelayRefetchContainer.js +12 -14
- package/lib/ReactRelayTestMocker.js +7 -8
- package/lib/RelayContext.js +3 -2
- package/lib/assertFragmentMap.js +2 -1
- package/lib/buildReactRelayContainer.js +7 -7
- package/lib/getRootVariablesForFragments.js +1 -2
- package/lib/hooks.js +5 -5
- package/lib/index.js +7 -7
- package/lib/jest-react/internalAct.js +2 -2
- package/lib/multi-actor/ActorChange.js +2 -2
- package/lib/multi-actor/useRelayActorEnvironment.js +2 -2
- package/lib/relay-hooks/EntryPointContainer.react.js +3 -3
- package/lib/relay-hooks/FragmentResource.js +241 -45
- package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +4 -4
- package/lib/relay-hooks/MatchContainer.js +1 -1
- package/lib/relay-hooks/QueryResource.js +83 -4
- package/lib/relay-hooks/SuspenseResource.js +130 -0
- package/lib/relay-hooks/loadQuery.js +8 -9
- package/lib/relay-hooks/preloadQuery_DEPRECATED.js +24 -10
- package/lib/relay-hooks/useBlockingPaginationFragment.js +2 -2
- package/lib/relay-hooks/useEntryPointLoader.js +2 -2
- package/lib/relay-hooks/useFetchTrackingRef.js +2 -1
- package/lib/relay-hooks/useFragment.js +8 -7
- package/lib/relay-hooks/useFragmentNode.js +4 -4
- package/lib/relay-hooks/useIsOperationNodeActive.js +2 -2
- package/lib/relay-hooks/useLazyLoadQuery.js +3 -3
- package/lib/relay-hooks/useLazyLoadQueryNode.js +4 -4
- package/lib/relay-hooks/useLoadMoreFunction.js +7 -9
- package/lib/relay-hooks/useMemoOperationDescriptor.js +2 -2
- package/lib/relay-hooks/useMemoVariables.js +2 -2
- package/lib/relay-hooks/useMutation.js +17 -6
- package/lib/relay-hooks/usePreloadedQuery.js +5 -5
- package/lib/relay-hooks/useQueryLoader.js +4 -4
- package/lib/relay-hooks/useRefetchableFragmentNode.js +10 -12
- package/lib/relay-hooks/useRelayEnvironment.js +2 -2
- package/lib/relay-hooks/useStaticFragmentNodeWarning.js +2 -2
- package/lib/relay-hooks/useSubscribeToInvalidationState.js +2 -1
- package/multi-actor/ActorChange.js.flow +3 -4
- package/multi-actor/useRelayActorEnvironment.js.flow +5 -7
- 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/relay-hooks/EntryPointContainer.react.js.flow +8 -15
- package/relay-hooks/EntryPointTypes.flow.js.flow +18 -24
- package/relay-hooks/FragmentResource.js.flow +220 -34
- package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +32 -46
- package/relay-hooks/MatchContainer.js.flow +3 -2
- package/relay-hooks/QueryResource.js.flow +119 -17
- package/relay-hooks/RelayEnvironmentProvider.js.flow +9 -9
- package/relay-hooks/SuspenseResource.js.flow +115 -0
- package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +4 -3
- package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +1 -1
- package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +10 -9
- package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +8 -7
- package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +10 -9
- package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +10 -9
- package/relay-hooks/__flowtests__/utils.js.flow +8 -12
- package/relay-hooks/loadEntryPoint.js.flow +6 -12
- package/relay-hooks/loadQuery.js.flow +22 -23
- package/relay-hooks/preloadQuery_DEPRECATED.js.flow +29 -13
- package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +6 -12
- package/relay-hooks/useBlockingPaginationFragment.js.flow +12 -13
- package/relay-hooks/useEntryPointLoader.js.flow +7 -10
- package/relay-hooks/useFetchTrackingRef.js.flow +2 -2
- package/relay-hooks/useFragment.js.flow +26 -46
- package/relay-hooks/useFragmentNode.js.flow +5 -7
- package/relay-hooks/useIsOperationNodeActive.js.flow +3 -5
- package/relay-hooks/useIsParentQueryActive.js.flow +3 -4
- package/relay-hooks/useLazyLoadQuery.js.flow +9 -10
- package/relay-hooks/useLazyLoadQueryNode.js.flow +11 -13
- package/relay-hooks/useLoadMoreFunction.js.flow +19 -27
- package/relay-hooks/useMemoOperationDescriptor.js.flow +5 -7
- package/relay-hooks/useMemoVariables.js.flow +6 -6
- package/relay-hooks/useMutation.js.flow +26 -26
- package/relay-hooks/usePaginationFragment.js.flow +37 -46
- package/relay-hooks/usePreloadedQuery.js.flow +13 -19
- package/relay-hooks/useQueryLoader.js.flow +13 -16
- package/relay-hooks/useRefetchableFragment.js.flow +7 -8
- package/relay-hooks/useRefetchableFragmentNode.js.flow +22 -30
- package/relay-hooks/useRelayEnvironment.js.flow +2 -4
- package/relay-hooks/useStaticFragmentNodeWarning.js.flow +2 -3
- package/relay-hooks/useSubscribeToInvalidationState.js.flow +3 -6
- package/relay-hooks/useSubscription.js.flow +6 -7
@@ -4,7 +4,7 @@
|
|
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<8cfc221caf8236a8279a0b578a4c03a3>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -15,20 +15,20 @@
|
|
15
15
|
'use strict';
|
16
16
|
|
17
17
|
/*::
|
18
|
-
import type { ReaderFragment } from 'relay-runtime';
|
19
|
-
type RelayModernFlowtest_user$
|
20
|
-
import type {
|
21
|
-
declare export opaque type RelayModernFlowtest_notref$
|
22
|
-
|
23
|
-
export type RelayModernFlowtest_notref = {|
|
18
|
+
import type { Fragment, ReaderFragment } from 'relay-runtime';
|
19
|
+
type RelayModernFlowtest_user$fragmentType = any;
|
20
|
+
import type { FragmentType } from "relay-runtime";
|
21
|
+
declare export opaque type RelayModernFlowtest_notref$fragmentType: FragmentType;
|
22
|
+
export type RelayModernFlowtest_notref$ref = RelayModernFlowtest_notref$fragmentType;
|
23
|
+
export type RelayModernFlowtest_notref$data = {|
|
24
24
|
+id: string,
|
25
|
-
+$
|
26
|
-
+$
|
25
|
+
+$fragmentSpreads: RelayModernFlowtest_user$fragmentType,
|
26
|
+
+$fragmentType: RelayModernFlowtest_notref$fragmentType,
|
27
27
|
|};
|
28
|
-
export type RelayModernFlowtest_notref
|
28
|
+
export type RelayModernFlowtest_notref = RelayModernFlowtest_notref$data;
|
29
29
|
export type RelayModernFlowtest_notref$key = {
|
30
30
|
+$data?: RelayModernFlowtest_notref$data,
|
31
|
-
+$
|
31
|
+
+$fragmentSpreads: RelayModernFlowtest_notref$fragmentType,
|
32
32
|
...
|
33
33
|
};
|
34
34
|
*/
|
@@ -60,4 +60,7 @@ if (__DEV__) {
|
|
60
60
|
(node/*: any*/).hash = "d61c43d07b2fe8f623c9b84fcdf70ac8";
|
61
61
|
}
|
62
62
|
|
63
|
-
module.exports = node
|
63
|
+
module.exports = ((node/*: any*/)/*: Fragment<
|
64
|
+
RelayModernFlowtest_notref$fragmentType,
|
65
|
+
RelayModernFlowtest_notref$data,
|
66
|
+
>*/);
|
@@ -4,7 +4,7 @@
|
|
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<9c7b60dab9f7983c67f2c7e1138f0eee>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -15,18 +15,18 @@
|
|
15
15
|
'use strict';
|
16
16
|
|
17
17
|
/*::
|
18
|
-
import type { ReaderFragment } from 'relay-runtime';
|
19
|
-
import type {
|
20
|
-
declare export opaque type RelayModernFlowtest_user$
|
21
|
-
|
22
|
-
export type RelayModernFlowtest_user = {|
|
18
|
+
import type { Fragment, ReaderFragment } from 'relay-runtime';
|
19
|
+
import type { FragmentType } from "relay-runtime";
|
20
|
+
declare export opaque type RelayModernFlowtest_user$fragmentType: FragmentType;
|
21
|
+
export type RelayModernFlowtest_user$ref = RelayModernFlowtest_user$fragmentType;
|
22
|
+
export type RelayModernFlowtest_user$data = {|
|
23
23
|
+name: ?string,
|
24
|
-
+$
|
24
|
+
+$fragmentType: RelayModernFlowtest_user$fragmentType,
|
25
25
|
|};
|
26
|
-
export type RelayModernFlowtest_user
|
26
|
+
export type RelayModernFlowtest_user = RelayModernFlowtest_user$data;
|
27
27
|
export type RelayModernFlowtest_user$key = {
|
28
28
|
+$data?: RelayModernFlowtest_user$data,
|
29
|
-
+$
|
29
|
+
+$fragmentSpreads: RelayModernFlowtest_user$fragmentType,
|
30
30
|
...
|
31
31
|
};
|
32
32
|
*/
|
@@ -53,4 +53,7 @@ if (__DEV__) {
|
|
53
53
|
(node/*: any*/).hash = "18a730295ff54e88446f4f000f5fef7e";
|
54
54
|
}
|
55
55
|
|
56
|
-
module.exports = node
|
56
|
+
module.exports = ((node/*: any*/)/*: Fragment<
|
57
|
+
RelayModernFlowtest_user$fragmentType,
|
58
|
+
RelayModernFlowtest_user$data,
|
59
|
+
>*/);
|
@@ -4,7 +4,7 @@
|
|
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<d2e1d6f0352e992d909d6217160aab1e>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -15,18 +15,18 @@
|
|
15
15
|
'use strict';
|
16
16
|
|
17
17
|
/*::
|
18
|
-
import type { ReaderFragment } from 'relay-runtime';
|
19
|
-
import type {
|
20
|
-
declare export opaque type RelayModernFlowtest_users$
|
21
|
-
|
22
|
-
export type RelayModernFlowtest_users = $ReadOnlyArray<{|
|
18
|
+
import type { Fragment, ReaderFragment } from 'relay-runtime';
|
19
|
+
import type { FragmentType } from "relay-runtime";
|
20
|
+
declare export opaque type RelayModernFlowtest_users$fragmentType: FragmentType;
|
21
|
+
export type RelayModernFlowtest_users$ref = RelayModernFlowtest_users$fragmentType;
|
22
|
+
export type RelayModernFlowtest_users$data = $ReadOnlyArray<{|
|
23
23
|
+name: ?string,
|
24
|
-
+$
|
24
|
+
+$fragmentType: RelayModernFlowtest_users$fragmentType,
|
25
25
|
|}>;
|
26
|
-
export type RelayModernFlowtest_users
|
26
|
+
export type RelayModernFlowtest_users = RelayModernFlowtest_users$data;
|
27
27
|
export type RelayModernFlowtest_users$key = $ReadOnlyArray<{
|
28
28
|
+$data?: RelayModernFlowtest_users$data,
|
29
|
-
+$
|
29
|
+
+$fragmentSpreads: RelayModernFlowtest_users$fragmentType,
|
30
30
|
...
|
31
31
|
}>;
|
32
32
|
*/
|
@@ -55,4 +55,7 @@ if (__DEV__) {
|
|
55
55
|
(node/*: any*/).hash = "4e6f0e70d48ec58651c17e3150c63d05";
|
56
56
|
}
|
57
57
|
|
58
|
-
module.exports = node
|
58
|
+
module.exports = ((node/*: any*/)/*: Fragment<
|
59
|
+
RelayModernFlowtest_users$fragmentType,
|
60
|
+
RelayModernFlowtest_users$data,
|
61
|
+
>*/);
|
@@ -12,10 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const invariant = require('invariant');
|
16
|
-
|
17
15
|
import type {GeneratedNodeMap} from './ReactRelayTypes';
|
18
16
|
|
17
|
+
const invariant = require('invariant');
|
18
|
+
|
19
19
|
/**
|
20
20
|
* Fail fast if the user supplies invalid fragments as input.
|
21
21
|
*/
|
@@ -12,23 +12,21 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
const ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext');
|
15
|
+
import type {GeneratedNodeMap} from './ReactRelayTypes';
|
16
|
+
import type {FragmentMap} from 'relay-runtime';
|
18
17
|
|
19
18
|
const assertFragmentMap = require('./assertFragmentMap');
|
20
|
-
const invariant = require('invariant');
|
21
|
-
const readContext = require('./readContext');
|
22
|
-
|
23
19
|
const {
|
24
20
|
getComponentName,
|
25
21
|
getContainerName,
|
26
22
|
} = require('./ReactRelayContainerUtils');
|
23
|
+
const ReactRelayContext = require('./ReactRelayContext');
|
24
|
+
const ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext');
|
25
|
+
const readContext = require('./readContext');
|
26
|
+
const invariant = require('invariant');
|
27
|
+
const React = require('react');
|
27
28
|
const {getFragment} = require('relay-runtime');
|
28
29
|
|
29
|
-
import type {GeneratedNodeMap} from './ReactRelayTypes';
|
30
|
-
import type {FragmentMap} from 'relay-runtime';
|
31
|
-
|
32
30
|
type ContainerCreator = (
|
33
31
|
Component: React$ComponentType<any>,
|
34
32
|
fragments: FragmentMap,
|
@@ -54,7 +52,10 @@ function buildReactRelayContainer<TBase: React$ComponentType<any>>(
|
|
54
52
|
const Container = createContainerWithFragments(ComponentClass, fragments);
|
55
53
|
Container.displayName = containerName;
|
56
54
|
|
57
|
-
function forwardRef(
|
55
|
+
function forwardRef(
|
56
|
+
props: any,
|
57
|
+
ref: ((null | any) => mixed) | {current: null | any, ...},
|
58
|
+
) {
|
58
59
|
const context = readContext(ReactRelayContext);
|
59
60
|
invariant(
|
60
61
|
context != null,
|
@@ -12,10 +12,10 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const {getSelector} = require('relay-runtime');
|
16
|
-
|
17
15
|
import type {FragmentMap, Variables} from 'relay-runtime';
|
18
16
|
|
17
|
+
const {getSelector} = require('relay-runtime');
|
18
|
+
|
19
19
|
function getRootVariablesForFragments<TProps: {...}>(
|
20
20
|
fragments: FragmentMap,
|
21
21
|
props: TProps,
|
@@ -32,11 +32,9 @@ function getRootVariablesForFragments<TProps: {...}>(
|
|
32
32
|
selector != null && selector.kind === 'PluralReaderSelector'
|
33
33
|
? selector.selectors[0]?.owner.variables ?? {}
|
34
34
|
: selector?.owner.variables ?? {};
|
35
|
-
// $FlowFixMe[cannot-spread-interface]
|
36
35
|
rootVariables = {
|
37
36
|
// $FlowFixMe[exponential-spread]
|
38
37
|
...rootVariables,
|
39
|
-
// $FlowFixMe[exponential-spread]
|
40
38
|
...fragmentOwnerVariables,
|
41
39
|
};
|
42
40
|
});
|
package/hooks.js
CHANGED
package/hooks.js.flow
CHANGED
@@ -13,10 +13,9 @@
|
|
13
13
|
'use strict';
|
14
14
|
|
15
15
|
const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
16
|
-
const RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
17
|
-
const RelayRuntime = require('relay-runtime');
|
18
|
-
|
19
16
|
const loadEntryPoint = require('./relay-hooks/loadEntryPoint');
|
17
|
+
const {loadQuery} = require('./relay-hooks/loadQuery');
|
18
|
+
const RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
20
19
|
const useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
|
21
20
|
const useFragment = require('./relay-hooks/useFragment');
|
22
21
|
const useLazyLoadQuery = require('./relay-hooks/useLazyLoadQuery');
|
@@ -28,8 +27,7 @@ const useRefetchableFragment = require('./relay-hooks/useRefetchableFragment');
|
|
28
27
|
const useRelayEnvironment = require('./relay-hooks/useRelayEnvironment');
|
29
28
|
const useSubscribeToInvalidationState = require('./relay-hooks/useSubscribeToInvalidationState');
|
30
29
|
const useSubscription = require('./relay-hooks/useSubscription');
|
31
|
-
|
32
|
-
const {loadQuery} = require('./relay-hooks/loadQuery');
|
30
|
+
const RelayRuntime = require('relay-runtime');
|
33
31
|
|
34
32
|
export type * from './relay-hooks/EntryPointTypes.flow';
|
35
33
|
export type {
|
package/index.js
CHANGED
package/index.js.flow
CHANGED
@@ -12,17 +12,16 @@
|
|
12
12
|
|
13
13
|
'use strict';
|
14
14
|
|
15
|
-
const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
16
15
|
const ReactRelayContext = require('./ReactRelayContext');
|
17
16
|
const ReactRelayFragmentContainer = require('./ReactRelayFragmentContainer');
|
18
17
|
const ReactRelayLocalQueryRenderer = require('./ReactRelayLocalQueryRenderer');
|
19
18
|
const ReactRelayPaginationContainer = require('./ReactRelayPaginationContainer');
|
20
19
|
const ReactRelayQueryRenderer = require('./ReactRelayQueryRenderer');
|
21
20
|
const ReactRelayRefetchContainer = require('./ReactRelayRefetchContainer');
|
22
|
-
const
|
23
|
-
const RelayRuntime = require('relay-runtime');
|
24
|
-
|
21
|
+
const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
25
22
|
const loadEntryPoint = require('./relay-hooks/loadEntryPoint');
|
23
|
+
const {loadQuery} = require('./relay-hooks/loadQuery');
|
24
|
+
const RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
26
25
|
const useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
|
27
26
|
const useFragment = require('./relay-hooks/useFragment');
|
28
27
|
const useLazyLoadQuery = require('./relay-hooks/useLazyLoadQuery');
|
@@ -34,8 +33,7 @@ const useRefetchableFragment = require('./relay-hooks/useRefetchableFragment');
|
|
34
33
|
const useRelayEnvironment = require('./relay-hooks/useRelayEnvironment');
|
35
34
|
const useSubscribeToInvalidationState = require('./relay-hooks/useSubscribeToInvalidationState');
|
36
35
|
const useSubscription = require('./relay-hooks/useSubscription');
|
37
|
-
|
38
|
-
const {loadQuery} = require('./relay-hooks/loadQuery');
|
36
|
+
const RelayRuntime = require('relay-runtime');
|
39
37
|
|
40
38
|
export type {
|
41
39
|
$FragmentRef,
|
@@ -29,7 +29,7 @@ function enqueueTask(task: () => void) {
|
|
29
29
|
// we're in a browser
|
30
30
|
// we can't use regular timers because they may still be faked
|
31
31
|
// so we try MessageChannel+postMessage instead
|
32
|
-
enqueueTaskImpl = function(callback: () => void) {
|
32
|
+
enqueueTaskImpl = function (callback: () => void) {
|
33
33
|
if (__DEV__) {
|
34
34
|
if (didWarnAboutMessageChannel === false) {
|
35
35
|
didWarnAboutMessageChannel = true;
|
@@ -22,9 +22,8 @@
|
|
22
22
|
|
23
23
|
'use strict';
|
24
24
|
|
25
|
-
const Scheduler = require('scheduler/unstable_mock');
|
26
|
-
|
27
25
|
const enqueueTask = require('./enqueueTask');
|
26
|
+
const Scheduler = require('scheduler/unstable_mock');
|
28
27
|
|
29
28
|
// The subset of a Promise that React APIs rely on. This resolves a value.
|
30
29
|
// This doesn't require a return value neither from the handler nor the
|
package/legacy.js
CHANGED
@@ -22,10 +22,6 @@ var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inh
|
|
22
22
|
|
23
23
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
24
24
|
|
25
|
-
var React = require('react');
|
26
|
-
|
27
|
-
var areEqual = require("fbjs/lib/areEqual");
|
28
|
-
|
29
25
|
var buildReactRelayContainer = require('./buildReactRelayContainer');
|
30
26
|
|
31
27
|
var _require = require('./ReactRelayContainerUtils'),
|
@@ -34,6 +30,10 @@ var _require = require('./ReactRelayContainerUtils'),
|
|
34
30
|
var _require2 = require('./RelayContext'),
|
35
31
|
assertRelayContext = _require2.assertRelayContext;
|
36
32
|
|
33
|
+
var areEqual = require("fbjs/lib/areEqual");
|
34
|
+
|
35
|
+
var React = require('react');
|
36
|
+
|
37
37
|
var _require3 = require('relay-runtime'),
|
38
38
|
createFragmentSpecResolver = _require3.createFragmentSpecResolver,
|
39
39
|
getDataIDsFromObject = _require3.getDataIDsFromObject,
|
@@ -10,10 +10,10 @@
|
|
10
10
|
// flowlint ambiguous-object-type:error
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
var React = require('react');
|
14
|
-
|
15
13
|
var ReactRelayContext = require('./ReactRelayContext');
|
16
14
|
|
15
|
+
var React = require('react');
|
16
|
+
|
17
17
|
function ReactRelayFragmentMockRenderer(props) {
|
18
18
|
return /*#__PURE__*/React.createElement(ReactRelayContext.Provider, {
|
19
19
|
value: {
|
@@ -10,24 +10,23 @@
|
|
10
10
|
// flowlint ambiguous-object-type:error
|
11
11
|
'use strict';
|
12
12
|
|
13
|
-
var React = require('react');
|
14
|
-
|
15
13
|
var ReactRelayContext = require('./ReactRelayContext');
|
16
14
|
|
17
15
|
var ReactRelayQueryRendererContext = require('./ReactRelayQueryRendererContext');
|
18
16
|
|
19
|
-
var
|
20
|
-
|
21
|
-
|
22
|
-
useMemo = React.useMemo;
|
17
|
+
var areEqual = require("fbjs/lib/areEqual");
|
18
|
+
|
19
|
+
var React = require('react');
|
23
20
|
|
24
21
|
var _require = require('relay-runtime'),
|
25
22
|
createOperationDescriptor = _require.createOperationDescriptor,
|
26
23
|
deepFreeze = _require.deepFreeze,
|
27
24
|
getRequest = _require.getRequest;
|
28
25
|
|
29
|
-
var
|
30
|
-
|
26
|
+
var useLayoutEffect = React.useLayoutEffect,
|
27
|
+
useState = React.useState,
|
28
|
+
useRef = React.useRef,
|
29
|
+
useMemo = React.useMemo;
|
31
30
|
var queryRendererContext = {
|
32
31
|
rootIsQueryRenderer: true
|
33
32
|
};
|
@@ -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 ? {
|
@@ -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) {
|
@@ -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
|
@@ -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;
|
@@ -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/RelayContext.js
CHANGED
@@ -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
@@ -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
|
|