react-relay 17.0.0 → 18.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/ReactRelayContainerUtils.js.flow +2 -2
  2. package/ReactRelayContext.js +1 -1
  3. package/ReactRelayContext.js.flow +1 -1
  4. package/ReactRelayFragmentContainer.js.flow +2 -2
  5. package/ReactRelayPaginationContainer.js.flow +2 -2
  6. package/ReactRelayQueryRenderer.js.flow +1 -1
  7. package/ReactRelayQueryRendererContext.js.flow +1 -1
  8. package/ReactRelayRefetchContainer.js.flow +2 -2
  9. package/ReactRelayTypes.js.flow +45 -18
  10. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +2 -2
  11. package/buildReactRelayContainer.js.flow +5 -5
  12. package/hooks.js +1 -1
  13. package/index.js +1 -1
  14. package/legacy.js +1 -1
  15. package/lib/relay-hooks/loadEntryPoint.js +8 -5
  16. package/lib/relay-hooks/loadQuery.js +2 -14
  17. package/lib/relay-hooks/useEntryPointLoader.js +5 -8
  18. package/lib/relay-hooks/useFragment.js +4 -7
  19. package/lib/relay-hooks/useFragmentInternal.js +6 -484
  20. package/lib/relay-hooks/useFragmentInternal_CURRENT.js +483 -0
  21. package/lib/relay-hooks/useFragmentInternal_EXPERIMENTAL.js +520 -0
  22. package/lib/relay-hooks/useLazyLoadQuery.js +2 -5
  23. package/lib/relay-hooks/usePreloadedQuery.js +6 -9
  24. package/lib/relay-hooks/useQueryLoader.js +1 -3
  25. package/multi-actor/ActorChange.js.flow +1 -1
  26. package/package.json +3 -3
  27. package/react-relay-hooks.js +2 -2
  28. package/react-relay-hooks.min.js +2 -2
  29. package/react-relay-legacy.js +1 -1
  30. package/react-relay-legacy.min.js +1 -1
  31. package/react-relay.js +2 -2
  32. package/react-relay.min.js +2 -2
  33. package/relay-hooks/EntryPointTypes.flow.js.flow +35 -12
  34. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +8 -4
  35. package/relay-hooks/MatchContainer.js.flow +1 -1
  36. package/relay-hooks/ProfilerContext.js.flow +1 -1
  37. package/relay-hooks/__flowtests__/EntryPointTypes/ExtractQueryTypes-flowtest.js.flow +43 -0
  38. package/relay-hooks/loadEntryPoint.js.flow +10 -4
  39. package/relay-hooks/loadQuery.js.flow +4 -28
  40. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +4 -1
  41. package/relay-hooks/useEntryPointLoader.js.flow +3 -4
  42. package/relay-hooks/useFragment.js.flow +0 -5
  43. package/relay-hooks/useFragmentInternal.js.flow +19 -643
  44. package/relay-hooks/useFragmentInternal_CURRENT.js.flow +669 -0
  45. package/relay-hooks/useFragmentInternal_EXPERIMENTAL.js.flow +764 -0
  46. package/relay-hooks/useLazyLoadQuery.js.flow +0 -5
  47. package/relay-hooks/usePaginationFragment.js.flow +1 -1
  48. package/relay-hooks/usePreloadedQuery.js.flow +0 -5
  49. package/relay-hooks/useQueryLoader.js.flow +1 -2
@@ -19,7 +19,6 @@ import type {
19
19
  Variables,
20
20
  } from 'relay-runtime';
21
21
 
22
- const {useTrackLoadQueryInRender} = require('./loadQuery');
23
22
  const useLazyLoadQueryNode = require('./useLazyLoadQueryNode');
24
23
  const useMemoOperationDescriptor = require('./useMemoOperationDescriptor');
25
24
  const useRelayEnvironment = require('./useRelayEnvironment');
@@ -51,10 +50,6 @@ hook useLazyLoadQuery<TVariables: Variables, TData>(
51
50
  UNSTABLE_renderPolicy?: RenderPolicy,
52
51
  },
53
52
  ): TData {
54
- // We need to use this hook in order to be able to track if
55
- // loadQuery was called during render
56
- useTrackLoadQueryInRender();
57
-
58
53
  const environment = useRelayEnvironment();
59
54
 
60
55
  const query = useMemoOperationDescriptor(
@@ -46,7 +46,7 @@ type RefetchFnBase<TVars, TOptions> = (
46
46
  options?: TOptions,
47
47
  ) => Disposable;
48
48
 
49
- type RefetchFn<TVariables, TKey, TOptions = Options> = RefetchFnBase<
49
+ export type RefetchFn<TVariables, TKey, TOptions = Options> = RefetchFnBase<
50
50
  RefetchVariables<TVariables, TKey>,
51
51
  TOptions,
52
52
  >;
@@ -18,7 +18,6 @@ import type {
18
18
  } from './EntryPointTypes.flow';
19
19
  import type {Query, RenderPolicy, Variables} from 'relay-runtime';
20
20
 
21
- const {useTrackLoadQueryInRender} = require('./loadQuery');
22
21
  const useLazyLoadQueryNode = require('./useLazyLoadQueryNode');
23
22
  const useMemoOperationDescriptor = require('./useMemoOperationDescriptor');
24
23
  const useRelayEnvironment = require('./useRelayEnvironment');
@@ -67,10 +66,6 @@ hook usePreloadedQuery<
67
66
  UNSTABLE_renderPolicy?: RenderPolicy,
68
67
  },
69
68
  ): TData {
70
- // We need to use this hook in order to be able to track if
71
- // loadQuery was called during render
72
- useTrackLoadQueryInRender();
73
-
74
69
  const environment = useRelayEnvironment();
75
70
  const {fetchKey, fetchPolicy, source, variables, networkCacheConfig} =
76
71
  preloadedQuery;
@@ -23,7 +23,7 @@ import type {
23
23
  Variables,
24
24
  } from 'relay-runtime';
25
25
 
26
- const {loadQuery, useTrackLoadQueryInRender} = require('./loadQuery');
26
+ const {loadQuery} = require('./loadQuery');
27
27
  const useIsMountedRef = require('./useIsMountedRef');
28
28
  const useRelayEnvironment = require('./useRelayEnvironment');
29
29
  const {useCallback, useEffect, useRef, useState} = require('react');
@@ -146,7 +146,6 @@ hook useQueryLoader<TVariables: Variables, TData, TRawResponse: ?{...} = void>(
146
146
  initialQueryReference ?? initialNullQueryReferenceState;
147
147
 
148
148
  const environment = useRelayEnvironment();
149
- useTrackLoadQueryInRender();
150
149
 
151
150
  const isMountedRef = useIsMountedRef();
152
151
  const undisposedQueryReferencesRef = useRef<