react-relay 13.1.1 → 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 +7 -6
- package/ReactRelayFragmentMockRenderer.js.flow +0 -2
- package/ReactRelayLocalQueryRenderer.js.flow +1 -3
- package/ReactRelayPaginationContainer.js.flow +13 -10
- package/ReactRelayQueryFetcher.js.flow +10 -11
- package/ReactRelayQueryRenderer.js.flow +15 -16
- package/ReactRelayQueryRendererContext.js.flow +1 -3
- package/ReactRelayRefetchContainer.js.flow +10 -7
- 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/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +2 -2
- package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +2 -2
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +3 -3
- package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +3 -3
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +3 -3
- package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +3 -3
- package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +2 -2
- package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +2 -2
- package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +2 -2
- package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +2 -2
- package/assertFragmentMap.js.flow +0 -2
- package/buildReactRelayContainer.js.flow +2 -4
- 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/jest-react/internalAct.js.flow +25 -9
- 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 +2 -2
- package/lib/ReactRelayQueryRenderer.js +2 -4
- 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/jest-react/internalAct.js +24 -4
- package/lib/legacy.js +0 -1
- package/lib/multi-actor/useRelayActorEnvironment.js +0 -1
- package/lib/readContext.js +2 -2
- package/lib/relay-hooks/EntryPointContainer.react.js +0 -1
- package/lib/relay-hooks/EntryPointTypes.flow.js +0 -1
- package/lib/relay-hooks/FragmentResource.js +68 -29
- package/lib/relay-hooks/HooksImplementation.js +29 -0
- 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 +2 -2
- package/lib/relay-hooks/ProfilerContext.js +0 -1
- package/lib/relay-hooks/QueryResource.js +5 -168
- 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 +8 -13
- package/lib/relay-hooks/prepareEntryPoint_DEPRECATED.js +0 -1
- package/lib/relay-hooks/react-cache/RelayReactCache.js +36 -0
- package/lib/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js +344 -0
- package/lib/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js +239 -0
- package/lib/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js +598 -0
- package/lib/relay-hooks/react-cache/useFragment_REACT_CACHE.js +50 -0
- package/lib/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js +55 -0
- package/lib/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js +150 -0
- package/lib/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js +124 -0
- 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 +15 -2
- package/lib/relay-hooks/useFragmentNode.js +0 -1
- package/lib/relay-hooks/useIsMountedRef.js +0 -1
- package/lib/relay-hooks/useLazyLoadQuery.js +4 -2
- 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 +5 -7
- package/lib/relay-hooks/usePaginationFragment.js +15 -3
- package/lib/relay-hooks/usePreloadedQuery.js +4 -2
- 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 +3 -3
- 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 +1 -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 +80 -37
- package/relay-hooks/HooksImplementation.js.flow +43 -0
- 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 +11 -6
- package/relay-hooks/ProfilerContext.js.flow +0 -2
- package/relay-hooks/QueryResource.js.flow +12 -209
- 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__/__generated__/useFragmentFlowtest_user.graphql.js.flow +2 -2
- package/relay-hooks/__flowtests__/__generated__/useFragmentFlowtest_users.graphql.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/loadQuery.js.flow +2 -1
- package/relay-hooks/preloadQuery_DEPRECATED.js.flow +11 -20
- package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +0 -2
- package/relay-hooks/react-cache/RelayReactCache.js.flow +40 -0
- package/relay-hooks/react-cache/getQueryResultOrFetchQuery_REACT_CACHE.js.flow +430 -0
- package/relay-hooks/react-cache/readFragmentInternal_REACT_CACHE.js.flow +297 -0
- package/relay-hooks/react-cache/useFragmentInternal_REACT_CACHE.js.flow +599 -0
- package/relay-hooks/react-cache/useFragment_REACT_CACHE.js.flow +72 -0
- package/relay-hooks/react-cache/useLazyLoadQuery_REACT_CACHE.js.flow +70 -0
- package/relay-hooks/react-cache/usePaginationFragment_REACT_CACHE.js.flow +171 -0
- package/relay-hooks/react-cache/usePreloadedQuery_REACT_CACHE.js.flow +151 -0
- 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 +17 -12
- package/relay-hooks/useFragmentNode.js.flow +2 -4
- package/relay-hooks/useIsMountedRef.js.flow +1 -3
- package/relay-hooks/useLazyLoadQuery.js.flow +17 -5
- 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 +5 -7
- package/relay-hooks/usePaginationFragment.js.flow +44 -19
- package/relay-hooks/usePreloadedQuery.js.flow +14 -5
- package/relay-hooks/useQueryLoader.js.flow +4 -6
- package/relay-hooks/useRefetchableFragment.js.flow +32 -3
- package/relay-hooks/useRefetchableFragmentNode.js.flow +38 -25
- 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 +14 -10
package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<23bcef30afc22a42d79dd52e0cfe899c>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<af6c4570779066ea564051c9c71c494f>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<6d173a357c286b417fdc586a839384d4>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -27,8 +27,8 @@ export type ReactRelayPaginationContainerFlowtestQuery$data = {|
|
|
27
27
|
|},
|
28
28
|
|};
|
29
29
|
export type ReactRelayPaginationContainerFlowtestQuery = {|
|
30
|
-
variables: ReactRelayPaginationContainerFlowtestQuery$variables,
|
31
30
|
response: ReactRelayPaginationContainerFlowtestQuery$data,
|
31
|
+
variables: ReactRelayPaginationContainerFlowtestQuery$variables,
|
32
32
|
|};
|
33
33
|
*/
|
34
34
|
|
package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<b3cddee250d0ff22e89a7f0331e85df6>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -23,7 +23,7 @@ export type ReactRelayPaginationContainerFlowtest_viewer$data = {|
|
|
23
23
|
+friends: ?{|
|
24
24
|
+edges: ?$ReadOnlyArray<?{|
|
25
25
|
+node: ?{|
|
26
|
-
+__typename:
|
26
|
+
+__typename: "User",
|
27
27
|
|},
|
28
28
|
|}>,
|
29
29
|
|},
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<3b1b16b5d5ec1c94783d6161ae61bc3d>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -27,8 +27,8 @@ export type ReactRelayRefetchContainerFlowtestQuery$data = {|
|
|
27
27
|
|},
|
28
28
|
|};
|
29
29
|
export type ReactRelayRefetchContainerFlowtestQuery = {|
|
30
|
-
variables: ReactRelayRefetchContainerFlowtestQuery$variables,
|
31
30
|
response: ReactRelayRefetchContainerFlowtestQuery$data,
|
31
|
+
variables: ReactRelayRefetchContainerFlowtestQuery$variables,
|
32
32
|
|};
|
33
33
|
*/
|
34
34
|
|
package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<6d04d7f7bf097d5869a1fdf0dea1e659>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -23,7 +23,7 @@ export type ReactRelayRefetchContainerFlowtest_viewer$data = {|
|
|
23
23
|
+friends: ?{|
|
24
24
|
+edges: ?$ReadOnlyArray<?{|
|
25
25
|
+node: ?{|
|
26
|
-
+__typename:
|
26
|
+
+__typename: "User",
|
27
27
|
|},
|
28
28
|
|}>,
|
29
29
|
|},
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<d3c71cb965d8374d40fb30f3c5ae9fd4>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<bd60df80c19d8248426865abbc23562e>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<527809017626cb43378afb92fed67feb>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -1,10 +1,10 @@
|
|
1
1
|
/**
|
2
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
|
-
* @generated SignedSource<<
|
7
|
+
* @generated SignedSource<<8a94ce305c03af7280da9b95a665349f>>
|
8
8
|
* @flow
|
9
9
|
* @lightSyntaxTransform
|
10
10
|
* @nogrep
|
@@ -8,10 +8,8 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
|
-
|
12
|
+
import type {ReaderFragment} from '../relay-runtime/util/ReaderNode';
|
15
13
|
import type {GeneratedNodeMap} from './ReactRelayTypes';
|
16
14
|
import type {FragmentMap} from 'relay-runtime';
|
17
15
|
|
@@ -45,7 +43,7 @@ function buildReactRelayContainer<TBase: React$ComponentType<any>>(
|
|
45
43
|
const containerName = getContainerName(ComponentClass);
|
46
44
|
assertFragmentMap(getComponentName(ComponentClass), fragmentSpec);
|
47
45
|
|
48
|
-
const fragments = {};
|
46
|
+
const fragments: {[string]: ReaderFragment} = {};
|
49
47
|
for (const key in fragmentSpec) {
|
50
48
|
fragments[key] = getFragment(fragmentSpec[key]);
|
51
49
|
}
|
package/hooks.js
CHANGED
package/hooks.js.flow
CHANGED
package/index.js
CHANGED
package/index.js.flow
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
* @format
|
9
9
|
*/
|
10
10
|
|
11
|
-
// flowlint ambiguous-object-type:error
|
12
|
-
|
13
11
|
'use strict';
|
14
12
|
|
15
13
|
const ReactRelayContext = require('./ReactRelayContext');
|
@@ -22,6 +20,7 @@ const EntryPointContainer = require('./relay-hooks/EntryPointContainer.react');
|
|
22
20
|
const loadEntryPoint = require('./relay-hooks/loadEntryPoint');
|
23
21
|
const {loadQuery} = require('./relay-hooks/loadQuery');
|
24
22
|
const RelayEnvironmentProvider = require('./relay-hooks/RelayEnvironmentProvider');
|
23
|
+
const useClientQuery = require('./relay-hooks/useClientQuery');
|
25
24
|
const useEntryPointLoader = require('./relay-hooks/useEntryPointLoader');
|
26
25
|
const useFragment = require('./relay-hooks/useFragment');
|
27
26
|
const useLazyLoadQuery = require('./relay-hooks/useLazyLoadQuery');
|
@@ -113,6 +112,7 @@ module.exports = {
|
|
113
112
|
loadQuery: loadQuery,
|
114
113
|
loadEntryPoint: loadEntryPoint,
|
115
114
|
|
115
|
+
useClientQuery: useClientQuery,
|
116
116
|
useFragment: useFragment,
|
117
117
|
useLazyLoadQuery: useLazyLoadQuery,
|
118
118
|
useEntryPointLoader: useEntryPointLoader,
|
@@ -36,7 +36,7 @@ interface Thenable<+R> {
|
|
36
36
|
|
37
37
|
let actingUpdatesScopeDepth = 0;
|
38
38
|
|
39
|
-
function act(scope: () => Thenable<
|
39
|
+
function act<T>(scope: () => Thenable<T> | T): Thenable<T> {
|
40
40
|
if (Scheduler.unstable_flushAllWithoutAsserting === undefined) {
|
41
41
|
throw Error(
|
42
42
|
'This version of `act` requires a special mock build of Scheduler.',
|
@@ -49,10 +49,19 @@ function act(scope: () => Thenable<mixed> | void) {
|
|
49
49
|
);
|
50
50
|
}
|
51
51
|
|
52
|
+
const previousIsActEnvironment = global.IS_REACT_ACT_ENVIRONMENT;
|
52
53
|
const previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
|
53
54
|
actingUpdatesScopeDepth++;
|
55
|
+
if (__DEV__ && actingUpdatesScopeDepth === 1) {
|
56
|
+
// Because this is not the "real" `act`, we set this to `false` so React
|
57
|
+
// knows not to fire `act` warnings.
|
58
|
+
global.IS_REACT_ACT_ENVIRONMENT = false;
|
59
|
+
}
|
54
60
|
|
55
61
|
const unwind = () => {
|
62
|
+
if (__DEV__ && actingUpdatesScopeDepth === 1) {
|
63
|
+
global.IS_REACT_ACT_ENVIRONMENT = previousIsActEnvironment;
|
64
|
+
}
|
56
65
|
actingUpdatesScopeDepth--;
|
57
66
|
|
58
67
|
if (__DEV__) {
|
@@ -71,20 +80,21 @@ function act(scope: () => Thenable<mixed> | void) {
|
|
71
80
|
// returned and 2) we could use async/await. Since it's only our used in
|
72
81
|
// our test suite, we should be able to.
|
73
82
|
try {
|
74
|
-
const
|
83
|
+
const result = scope();
|
75
84
|
if (
|
76
|
-
typeof
|
77
|
-
|
78
|
-
typeof
|
85
|
+
typeof result === 'object' &&
|
86
|
+
result !== null &&
|
87
|
+
typeof result.then === 'function'
|
79
88
|
) {
|
89
|
+
const thenableResult: Thenable<T> = (result: any);
|
80
90
|
return {
|
81
|
-
then(resolve
|
82
|
-
|
83
|
-
|
91
|
+
then(resolve, reject) {
|
92
|
+
thenableResult.then(
|
93
|
+
returnValue => {
|
84
94
|
flushActWork(
|
85
95
|
() => {
|
86
96
|
unwind();
|
87
|
-
resolve();
|
97
|
+
resolve(returnValue);
|
88
98
|
},
|
89
99
|
error => {
|
90
100
|
unwind();
|
@@ -100,6 +110,7 @@ function act(scope: () => Thenable<mixed> | void) {
|
|
100
110
|
},
|
101
111
|
};
|
102
112
|
} else {
|
113
|
+
const returnValue: T = (result: any);
|
103
114
|
try {
|
104
115
|
// TODO: Let's not support non-async scopes at all in our tests. Need to
|
105
116
|
// migrate existing tests.
|
@@ -107,6 +118,11 @@ function act(scope: () => Thenable<mixed> | void) {
|
|
107
118
|
do {
|
108
119
|
didFlushWork = Scheduler.unstable_flushAllWithoutAsserting();
|
109
120
|
} while (didFlushWork);
|
121
|
+
return {
|
122
|
+
then(resolve, reject) {
|
123
|
+
resolve(returnValue);
|
124
|
+
},
|
125
|
+
};
|
110
126
|
} finally {
|
111
127
|
unwind();
|
112
128
|
}
|
package/legacy.js
CHANGED
package/legacy.js.flow
CHANGED
package/lib/ReactRelayContext.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 _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
|
|
@@ -153,6 +152,7 @@ var ReactRelayQueryFetcher = /*#__PURE__*/function () {
|
|
153
152
|
};
|
154
153
|
|
155
154
|
if (onDataChange && this._fetchOptions.onDataChangeCallbacks.indexOf(onDataChange) === -1) {
|
155
|
+
// $FlowFixMe[incompatible-use]
|
156
156
|
this._fetchOptions.onDataChangeCallbacks.push(onDataChange);
|
157
157
|
}
|
158
158
|
|
@@ -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
|
|
@@ -31,7 +30,6 @@ var areEqual = require("fbjs/lib/areEqual");
|
|
31
30
|
var React = require('react');
|
32
31
|
|
33
32
|
var _require = require('relay-runtime'),
|
34
|
-
RelayFeatureFlags = _require.RelayFeatureFlags,
|
35
33
|
createOperationDescriptor = _require.createOperationDescriptor,
|
36
34
|
deepFreeze = _require.deepFreeze,
|
37
35
|
getRequest = _require.getRequest;
|
@@ -132,7 +130,7 @@ var ReactRelayQueryRenderer = /*#__PURE__*/function (_React$Component) {
|
|
132
130
|
_proto.componentDidMount = function componentDidMount() {
|
133
131
|
var _this2 = this;
|
134
132
|
|
135
|
-
if (
|
133
|
+
if (this._maybeHiddenOrFastRefresh === true) {
|
136
134
|
// This block only runs if the component has previously "unmounted"
|
137
135
|
// due to it being hidden by the Offscreen API, or during fast refresh.
|
138
136
|
// At this point, the current cached resource will have been disposed
|