react-relay 16.1.0 → 17.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/ReactRelayContext.js +1 -1
- package/ReactRelayFragmentContainer.js.flow +8 -6
- package/ReactRelayLocalQueryRenderer.js.flow +4 -1
- package/ReactRelayPaginationContainer.js.flow +2 -0
- package/ReactRelayQueryRenderer.js.flow +1 -1
- package/ReactRelayTypes.js.flow +1 -0
- package/buildReactRelayContainer.js.flow +5 -3
- package/getRootVariablesForFragments.js.flow +1 -0
- package/hooks.js +1 -1
- package/hooks.js.flow +1 -1
- package/index.js +1 -1
- package/index.js.flow +1 -1
- package/legacy.js +1 -1
- package/lib/ReactRelayFragmentContainer.js +2 -2
- package/lib/buildReactRelayContainer.js +3 -3
- package/lib/relay-hooks/SuspenseResource.js +7 -4
- package/lib/relay-hooks/{FragmentResource.js → legacy/FragmentResource.js} +19 -20
- package/lib/relay-hooks/{useBlockingPaginationFragment.js → legacy/useBlockingPaginationFragment.js} +2 -2
- package/lib/relay-hooks/{useFragmentNode.js → legacy/useFragmentNode.js} +2 -2
- package/lib/relay-hooks/{useRefetchableFragmentNode.js → legacy/useRefetchableFragmentNode.js} +8 -8
- package/lib/relay-hooks/{experimental/readFragmentInternal_EXPERIMENTAL.js → readFragmentInternal.js} +7 -5
- package/lib/relay-hooks/useFragment.js +3 -13
- package/lib/relay-hooks/{experimental/useFragmentInternal_EXPERIMENTAL.js → useFragmentInternal.js} +67 -31
- package/lib/relay-hooks/useLazyLoadQueryNode.js +2 -13
- package/lib/relay-hooks/usePaginationFragment.js +17 -13
- package/lib/relay-hooks/useRefetchableFragment.js +3 -12
- package/lib/relay-hooks/{experimental/useRefetchableFragmentInternal_EXPERIMENTAL.js → useRefetchableFragmentInternal.js} +7 -7
- package/multi-actor/useRelayActorEnvironment.js.flow +1 -1
- 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/EntryPointTypes.flow.js.flow +22 -27
- package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +14 -1
- package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +5 -11
- package/relay-hooks/SuspenseResource.js.flow +11 -8
- package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +22 -1
- package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +19 -0
- package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +22 -0
- package/relay-hooks/{FragmentResource.js.flow → legacy/FragmentResource.js.flow} +21 -21
- package/relay-hooks/{useBlockingPaginationFragment.js.flow → legacy/useBlockingPaginationFragment.js.flow} +6 -6
- package/relay-hooks/{useFragmentNode.js.flow → legacy/useFragmentNode.js.flow} +3 -3
- package/relay-hooks/{useRefetchableFragmentNode.js.flow → legacy/useRefetchableFragmentNode.js.flow} +9 -9
- package/relay-hooks/loadQuery.js.flow +9 -8
- package/relay-hooks/{experimental/readFragmentInternal_EXPERIMENTAL.js.flow → readFragmentInternal.js.flow} +8 -4
- package/relay-hooks/useClientQuery.js.flow +1 -1
- package/relay-hooks/useEntryPointLoader.js.flow +1 -1
- package/relay-hooks/useFetchTrackingRef.js.flow +1 -1
- package/relay-hooks/useFragment.js.flow +16 -22
- package/relay-hooks/{experimental/useFragmentInternal_EXPERIMENTAL.js.flow → useFragmentInternal.js.flow} +71 -19
- package/relay-hooks/useIsMountedRef.js.flow +1 -1
- package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
- package/relay-hooks/useIsParentQueryActive.js.flow +5 -2
- package/relay-hooks/useLazyLoadQuery.js.flow +3 -2
- package/relay-hooks/useLazyLoadQueryNode.js.flow +3 -19
- package/relay-hooks/useLoadMoreFunction.js.flow +1 -1
- package/relay-hooks/useMemoOperationDescriptor.js.flow +1 -1
- package/relay-hooks/useMemoVariables.js.flow +1 -1
- package/relay-hooks/useMutation.js.flow +1 -1
- package/relay-hooks/usePaginationFragment.js.flow +62 -50
- package/relay-hooks/usePreloadedQuery.js.flow +2 -1
- package/relay-hooks/useQueryLoader.js.flow +2 -5
- package/relay-hooks/useRefetchableFragment.js.flow +7 -37
- package/relay-hooks/{experimental/useRefetchableFragmentInternal_EXPERIMENTAL.js.flow → useRefetchableFragmentInternal.js.flow} +11 -11
- package/relay-hooks/useRelayEnvironment.js.flow +1 -1
- package/relay-hooks/useStaticFragmentNodeWarning.js.flow +3 -1
- package/relay-hooks/useSubscribeToInvalidationState.js.flow +1 -1
- package/relay-hooks/useSubscription.js.flow +1 -1
- package/relay-hooks/useUnsafeRef_DEPRECATED.js.flow +1 -1
- package/lib/relay-hooks/HooksImplementation.js +0 -15
- package/lib/relay-hooks/experimental/useFragment_EXPERIMENTAL.js +0 -26
- package/lib/relay-hooks/experimental/usePaginationFragment_EXPERIMENTAL.js +0 -127
- package/lib/relay-hooks/experimental/useRefetchableFragment_EXPERIMENTAL.js +0 -23
- package/relay-hooks/HooksImplementation.js.flow +0 -45
- package/relay-hooks/experimental/useFragment_EXPERIMENTAL.js.flow +0 -66
- package/relay-hooks/experimental/usePaginationFragment_EXPERIMENTAL.js.flow +0 -161
- package/relay-hooks/experimental/useRefetchableFragment_EXPERIMENTAL.js.flow +0 -49
@@ -1,49 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*
|
7
|
-
* @flow strict-local
|
8
|
-
* @format
|
9
|
-
* @oncall relay
|
10
|
-
*/
|
11
|
-
|
12
|
-
'use strict';
|
13
|
-
|
14
|
-
import type {ReturnType} from '../useRefetchableFragment';
|
15
|
-
import type {FragmentType, RefetchableFragment, Variables} from 'relay-runtime';
|
16
|
-
|
17
|
-
const useStaticFragmentNodeWarning = require('../useStaticFragmentNodeWarning');
|
18
|
-
const useRefetchableFragmentInternal = require('./useRefetchableFragmentInternal_EXPERIMENTAL');
|
19
|
-
const {useDebugValue} = require('react');
|
20
|
-
const {getFragment} = require('relay-runtime');
|
21
|
-
|
22
|
-
function useRefetchableFragment<
|
23
|
-
TFragmentType: FragmentType,
|
24
|
-
TVariables: Variables,
|
25
|
-
TData,
|
26
|
-
TKey: ?{+$fragmentSpreads: TFragmentType, ...},
|
27
|
-
>(
|
28
|
-
fragmentInput: RefetchableFragment<TFragmentType, TData, TVariables>,
|
29
|
-
fragmentRef: TKey,
|
30
|
-
): ReturnType<TVariables, TData, TKey> {
|
31
|
-
const fragmentNode = getFragment(fragmentInput);
|
32
|
-
useStaticFragmentNodeWarning(
|
33
|
-
fragmentNode,
|
34
|
-
'first argument of useRefetchableFragment()',
|
35
|
-
);
|
36
|
-
const {fragmentData, refetch} = useRefetchableFragmentInternal<
|
37
|
-
{variables: TVariables, response: TData},
|
38
|
-
{data?: TData},
|
39
|
-
>(fragmentNode, fragmentRef, 'useRefetchableFragment()');
|
40
|
-
if (__DEV__) {
|
41
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
42
|
-
useDebugValue({fragment: fragmentNode.name, data: fragmentData});
|
43
|
-
}
|
44
|
-
// $FlowFixMe[incompatible-return]
|
45
|
-
// $FlowFixMe[prop-missing]
|
46
|
-
return [fragmentData, refetch];
|
47
|
-
}
|
48
|
-
|
49
|
-
module.exports = useRefetchableFragment;
|