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.
Files changed (80) hide show
  1. package/ReactRelayContext.js +1 -1
  2. package/ReactRelayFragmentContainer.js.flow +8 -6
  3. package/ReactRelayLocalQueryRenderer.js.flow +4 -1
  4. package/ReactRelayPaginationContainer.js.flow +2 -0
  5. package/ReactRelayQueryRenderer.js.flow +1 -1
  6. package/ReactRelayTypes.js.flow +1 -0
  7. package/buildReactRelayContainer.js.flow +5 -3
  8. package/getRootVariablesForFragments.js.flow +1 -0
  9. package/hooks.js +1 -1
  10. package/hooks.js.flow +1 -1
  11. package/index.js +1 -1
  12. package/index.js.flow +1 -1
  13. package/legacy.js +1 -1
  14. package/lib/ReactRelayFragmentContainer.js +2 -2
  15. package/lib/buildReactRelayContainer.js +3 -3
  16. package/lib/relay-hooks/SuspenseResource.js +7 -4
  17. package/lib/relay-hooks/{FragmentResource.js → legacy/FragmentResource.js} +19 -20
  18. package/lib/relay-hooks/{useBlockingPaginationFragment.js → legacy/useBlockingPaginationFragment.js} +2 -2
  19. package/lib/relay-hooks/{useFragmentNode.js → legacy/useFragmentNode.js} +2 -2
  20. package/lib/relay-hooks/{useRefetchableFragmentNode.js → legacy/useRefetchableFragmentNode.js} +8 -8
  21. package/lib/relay-hooks/{experimental/readFragmentInternal_EXPERIMENTAL.js → readFragmentInternal.js} +7 -5
  22. package/lib/relay-hooks/useFragment.js +3 -13
  23. package/lib/relay-hooks/{experimental/useFragmentInternal_EXPERIMENTAL.js → useFragmentInternal.js} +67 -31
  24. package/lib/relay-hooks/useLazyLoadQueryNode.js +2 -13
  25. package/lib/relay-hooks/usePaginationFragment.js +17 -13
  26. package/lib/relay-hooks/useRefetchableFragment.js +3 -12
  27. package/lib/relay-hooks/{experimental/useRefetchableFragmentInternal_EXPERIMENTAL.js → useRefetchableFragmentInternal.js} +7 -7
  28. package/multi-actor/useRelayActorEnvironment.js.flow +1 -1
  29. package/package.json +2 -2
  30. package/react-relay-hooks.js +2 -2
  31. package/react-relay-hooks.min.js +2 -2
  32. package/react-relay-legacy.js +2 -2
  33. package/react-relay-legacy.min.js +2 -2
  34. package/react-relay.js +2 -2
  35. package/react-relay.min.js +2 -2
  36. package/relay-hooks/EntryPointTypes.flow.js.flow +22 -27
  37. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +14 -1
  38. package/relay-hooks/NestedRelayEntryPointBuilderUtils.js.flow +5 -11
  39. package/relay-hooks/SuspenseResource.js.flow +11 -8
  40. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +22 -1
  41. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +19 -0
  42. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +22 -0
  43. package/relay-hooks/{FragmentResource.js.flow → legacy/FragmentResource.js.flow} +21 -21
  44. package/relay-hooks/{useBlockingPaginationFragment.js.flow → legacy/useBlockingPaginationFragment.js.flow} +6 -6
  45. package/relay-hooks/{useFragmentNode.js.flow → legacy/useFragmentNode.js.flow} +3 -3
  46. package/relay-hooks/{useRefetchableFragmentNode.js.flow → legacy/useRefetchableFragmentNode.js.flow} +9 -9
  47. package/relay-hooks/loadQuery.js.flow +9 -8
  48. package/relay-hooks/{experimental/readFragmentInternal_EXPERIMENTAL.js.flow → readFragmentInternal.js.flow} +8 -4
  49. package/relay-hooks/useClientQuery.js.flow +1 -1
  50. package/relay-hooks/useEntryPointLoader.js.flow +1 -1
  51. package/relay-hooks/useFetchTrackingRef.js.flow +1 -1
  52. package/relay-hooks/useFragment.js.flow +16 -22
  53. package/relay-hooks/{experimental/useFragmentInternal_EXPERIMENTAL.js.flow → useFragmentInternal.js.flow} +71 -19
  54. package/relay-hooks/useIsMountedRef.js.flow +1 -1
  55. package/relay-hooks/useIsOperationNodeActive.js.flow +1 -1
  56. package/relay-hooks/useIsParentQueryActive.js.flow +5 -2
  57. package/relay-hooks/useLazyLoadQuery.js.flow +3 -2
  58. package/relay-hooks/useLazyLoadQueryNode.js.flow +3 -19
  59. package/relay-hooks/useLoadMoreFunction.js.flow +1 -1
  60. package/relay-hooks/useMemoOperationDescriptor.js.flow +1 -1
  61. package/relay-hooks/useMemoVariables.js.flow +1 -1
  62. package/relay-hooks/useMutation.js.flow +1 -1
  63. package/relay-hooks/usePaginationFragment.js.flow +62 -50
  64. package/relay-hooks/usePreloadedQuery.js.flow +2 -1
  65. package/relay-hooks/useQueryLoader.js.flow +2 -5
  66. package/relay-hooks/useRefetchableFragment.js.flow +7 -37
  67. package/relay-hooks/{experimental/useRefetchableFragmentInternal_EXPERIMENTAL.js.flow → useRefetchableFragmentInternal.js.flow} +11 -11
  68. package/relay-hooks/useRelayEnvironment.js.flow +1 -1
  69. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +3 -1
  70. package/relay-hooks/useSubscribeToInvalidationState.js.flow +1 -1
  71. package/relay-hooks/useSubscription.js.flow +1 -1
  72. package/relay-hooks/useUnsafeRef_DEPRECATED.js.flow +1 -1
  73. package/lib/relay-hooks/HooksImplementation.js +0 -15
  74. package/lib/relay-hooks/experimental/useFragment_EXPERIMENTAL.js +0 -26
  75. package/lib/relay-hooks/experimental/usePaginationFragment_EXPERIMENTAL.js +0 -127
  76. package/lib/relay-hooks/experimental/useRefetchableFragment_EXPERIMENTAL.js +0 -23
  77. package/relay-hooks/HooksImplementation.js.flow +0 -45
  78. package/relay-hooks/experimental/useFragment_EXPERIMENTAL.js.flow +0 -66
  79. package/relay-hooks/experimental/usePaginationFragment_EXPERIMENTAL.js.flow +0 -161
  80. 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;