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.
Files changed (133) hide show
  1. package/ReactRelayContext.js +1 -1
  2. package/ReactRelayContext.js.flow +2 -3
  3. package/ReactRelayFragmentContainer.js.flow +10 -16
  4. package/ReactRelayFragmentMockRenderer.js.flow +1 -1
  5. package/ReactRelayLocalQueryRenderer.js.flow +6 -7
  6. package/ReactRelayPaginationContainer.js.flow +29 -39
  7. package/ReactRelayQueryFetcher.js.flow +9 -10
  8. package/ReactRelayQueryRenderer.js.flow +15 -15
  9. package/ReactRelayRefetchContainer.js.flow +24 -32
  10. package/ReactRelayTestMocker.js.flow +16 -14
  11. package/ReactRelayTypes.js.flow +10 -10
  12. package/RelayContext.js.flow +3 -3
  13. package/__flowtests__/ReactRelayFragmentContainer-flowtest.js.flow +1 -2
  14. package/__flowtests__/ReactRelayPaginationContainer-flowtest.js.flow +1 -2
  15. package/__flowtests__/ReactRelayRefetchContainer-flowtest.js.flow +1 -2
  16. package/__flowtests__/RelayModern-flowtest.js.flow +78 -46
  17. package/__flowtests__/RelayModernFlowtest_badref.graphql.js.flow +5 -4
  18. package/__flowtests__/RelayModernFlowtest_notref.graphql.js.flow +5 -4
  19. package/__flowtests__/RelayModernFlowtest_user.graphql.js.flow +4 -3
  20. package/__flowtests__/RelayModernFlowtest_users.graphql.js.flow +4 -3
  21. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer.graphql.js.flow +13 -10
  22. package/__flowtests__/__generated__/ReactRelayFragmentContainerFlowtest_viewer2.graphql.js.flow +13 -10
  23. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtestQuery.graphql.js.flow +13 -8
  24. package/__flowtests__/__generated__/ReactRelayPaginationContainerFlowtest_viewer.graphql.js.flow +13 -10
  25. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtestQuery.graphql.js.flow +13 -8
  26. package/__flowtests__/__generated__/ReactRelayRefetchContainerFlowtest_viewer.graphql.js.flow +13 -10
  27. package/__flowtests__/__generated__/RelayModernFlowtest_badref.graphql.js.flow +15 -12
  28. package/__flowtests__/__generated__/RelayModernFlowtest_notref.graphql.js.flow +15 -12
  29. package/__flowtests__/__generated__/RelayModernFlowtest_user.graphql.js.flow +13 -10
  30. package/__flowtests__/__generated__/RelayModernFlowtest_users.graphql.js.flow +13 -10
  31. package/assertFragmentMap.js.flow +2 -2
  32. package/buildReactRelayContainer.js.flow +11 -10
  33. package/getRootVariablesForFragments.js.flow +2 -4
  34. package/hooks.js +1 -1
  35. package/hooks.js.flow +3 -5
  36. package/index.js +1 -1
  37. package/index.js.flow +4 -6
  38. package/jest-react/enqueueTask.js.flow +1 -1
  39. package/jest-react/internalAct.js.flow +1 -2
  40. package/legacy.js +1 -1
  41. package/lib/ReactRelayFragmentContainer.js +4 -4
  42. package/lib/ReactRelayFragmentMockRenderer.js +2 -2
  43. package/lib/ReactRelayLocalQueryRenderer.js +7 -8
  44. package/lib/ReactRelayPaginationContainer.js +18 -22
  45. package/lib/ReactRelayQueryFetcher.js +2 -2
  46. package/lib/ReactRelayQueryRenderer.js +4 -4
  47. package/lib/ReactRelayRefetchContainer.js +12 -14
  48. package/lib/ReactRelayTestMocker.js +7 -8
  49. package/lib/RelayContext.js +3 -2
  50. package/lib/assertFragmentMap.js +2 -1
  51. package/lib/buildReactRelayContainer.js +7 -7
  52. package/lib/getRootVariablesForFragments.js +1 -2
  53. package/lib/hooks.js +5 -5
  54. package/lib/index.js +7 -7
  55. package/lib/jest-react/internalAct.js +2 -2
  56. package/lib/multi-actor/ActorChange.js +2 -2
  57. package/lib/multi-actor/useRelayActorEnvironment.js +2 -2
  58. package/lib/relay-hooks/EntryPointContainer.react.js +3 -3
  59. package/lib/relay-hooks/FragmentResource.js +241 -45
  60. package/lib/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js +4 -4
  61. package/lib/relay-hooks/MatchContainer.js +1 -1
  62. package/lib/relay-hooks/QueryResource.js +83 -4
  63. package/lib/relay-hooks/SuspenseResource.js +130 -0
  64. package/lib/relay-hooks/loadQuery.js +8 -9
  65. package/lib/relay-hooks/preloadQuery_DEPRECATED.js +24 -10
  66. package/lib/relay-hooks/useBlockingPaginationFragment.js +2 -2
  67. package/lib/relay-hooks/useEntryPointLoader.js +2 -2
  68. package/lib/relay-hooks/useFetchTrackingRef.js +2 -1
  69. package/lib/relay-hooks/useFragment.js +8 -7
  70. package/lib/relay-hooks/useFragmentNode.js +4 -4
  71. package/lib/relay-hooks/useIsOperationNodeActive.js +2 -2
  72. package/lib/relay-hooks/useLazyLoadQuery.js +3 -3
  73. package/lib/relay-hooks/useLazyLoadQueryNode.js +4 -4
  74. package/lib/relay-hooks/useLoadMoreFunction.js +7 -9
  75. package/lib/relay-hooks/useMemoOperationDescriptor.js +2 -2
  76. package/lib/relay-hooks/useMemoVariables.js +2 -2
  77. package/lib/relay-hooks/useMutation.js +17 -6
  78. package/lib/relay-hooks/usePreloadedQuery.js +5 -5
  79. package/lib/relay-hooks/useQueryLoader.js +4 -4
  80. package/lib/relay-hooks/useRefetchableFragmentNode.js +10 -12
  81. package/lib/relay-hooks/useRelayEnvironment.js +2 -2
  82. package/lib/relay-hooks/useStaticFragmentNodeWarning.js +2 -2
  83. package/lib/relay-hooks/useSubscribeToInvalidationState.js +2 -1
  84. package/multi-actor/ActorChange.js.flow +3 -4
  85. package/multi-actor/useRelayActorEnvironment.js.flow +5 -7
  86. package/package.json +2 -2
  87. package/react-relay-hooks.js +2 -2
  88. package/react-relay-hooks.min.js +2 -2
  89. package/react-relay-legacy.js +2 -2
  90. package/react-relay-legacy.min.js +2 -2
  91. package/react-relay.js +2 -2
  92. package/react-relay.min.js +2 -2
  93. package/relay-hooks/EntryPointContainer.react.js.flow +8 -15
  94. package/relay-hooks/EntryPointTypes.flow.js.flow +18 -24
  95. package/relay-hooks/FragmentResource.js.flow +220 -34
  96. package/relay-hooks/LazyLoadEntryPointContainer_DEPRECATED.react.js.flow +32 -46
  97. package/relay-hooks/MatchContainer.js.flow +3 -2
  98. package/relay-hooks/QueryResource.js.flow +119 -17
  99. package/relay-hooks/RelayEnvironmentProvider.js.flow +9 -9
  100. package/relay-hooks/SuspenseResource.js.flow +115 -0
  101. package/relay-hooks/__flowtests__/EntryPointTypes/EntryPointElementConfig-flowtest.js.flow +4 -3
  102. package/relay-hooks/__flowtests__/EntryPointTypes/NestedEntrypoints-flowtest.js.flow +1 -1
  103. package/relay-hooks/__flowtests__/useBlockingPaginationFragment-flowtest.js.flow +10 -9
  104. package/relay-hooks/__flowtests__/useFragment-flowtest.js.flow +8 -7
  105. package/relay-hooks/__flowtests__/usePaginationFragment-flowtest.js.flow +10 -9
  106. package/relay-hooks/__flowtests__/useRefetchableFragment-flowtest.js.flow +10 -9
  107. package/relay-hooks/__flowtests__/utils.js.flow +8 -12
  108. package/relay-hooks/loadEntryPoint.js.flow +6 -12
  109. package/relay-hooks/loadQuery.js.flow +22 -23
  110. package/relay-hooks/preloadQuery_DEPRECATED.js.flow +29 -13
  111. package/relay-hooks/prepareEntryPoint_DEPRECATED.js.flow +6 -12
  112. package/relay-hooks/useBlockingPaginationFragment.js.flow +12 -13
  113. package/relay-hooks/useEntryPointLoader.js.flow +7 -10
  114. package/relay-hooks/useFetchTrackingRef.js.flow +2 -2
  115. package/relay-hooks/useFragment.js.flow +26 -46
  116. package/relay-hooks/useFragmentNode.js.flow +5 -7
  117. package/relay-hooks/useIsOperationNodeActive.js.flow +3 -5
  118. package/relay-hooks/useIsParentQueryActive.js.flow +3 -4
  119. package/relay-hooks/useLazyLoadQuery.js.flow +9 -10
  120. package/relay-hooks/useLazyLoadQueryNode.js.flow +11 -13
  121. package/relay-hooks/useLoadMoreFunction.js.flow +19 -27
  122. package/relay-hooks/useMemoOperationDescriptor.js.flow +5 -7
  123. package/relay-hooks/useMemoVariables.js.flow +6 -6
  124. package/relay-hooks/useMutation.js.flow +26 -26
  125. package/relay-hooks/usePaginationFragment.js.flow +37 -46
  126. package/relay-hooks/usePreloadedQuery.js.flow +13 -19
  127. package/relay-hooks/useQueryLoader.js.flow +13 -16
  128. package/relay-hooks/useRefetchableFragment.js.flow +7 -8
  129. package/relay-hooks/useRefetchableFragmentNode.js.flow +22 -30
  130. package/relay-hooks/useRelayEnvironment.js.flow +2 -4
  131. package/relay-hooks/useStaticFragmentNodeWarning.js.flow +2 -3
  132. package/relay-hooks/useSubscribeToInvalidationState.js.flow +3 -6
  133. package/relay-hooks/useSubscription.js.flow +6 -7
@@ -13,24 +13,23 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const invariant = require('invariant');
16
+ import type {PreloadedQuery} from './EntryPointTypes.flow';
17
+ import type {
18
+ GraphQLTaggedNode,
19
+ OperationType,
20
+ RenderPolicy,
21
+ } from 'relay-runtime';
22
+
23
+ const {useTrackLoadQueryInRender} = require('./loadQuery');
17
24
  const useLazyLoadQueryNode = require('./useLazyLoadQueryNode');
18
25
  const useMemoOperationDescriptor = require('./useMemoOperationDescriptor');
19
26
  const useRelayEnvironment = require('./useRelayEnvironment');
20
- const warning = require('warning');
21
-
22
- const {useTrackLoadQueryInRender} = require('./loadQuery');
27
+ const invariant = require('invariant');
23
28
  const {useDebugValue} = require('react');
24
29
  const {
25
30
  __internal: {fetchQueryDeduped, fetchQuery},
26
31
  } = require('relay-runtime');
27
-
28
- import type {PreloadedQuery} from './EntryPointTypes.flow';
29
- import type {
30
- GraphQLTaggedNode,
31
- OperationType,
32
- RenderPolicy,
33
- } from 'relay-runtime';
32
+ const warning = require('warning');
34
33
 
35
34
  function usePreloadedQuery<TQuery: OperationType>(
36
35
  gqlQuery: GraphQLTaggedNode,
@@ -38,19 +37,14 @@ function usePreloadedQuery<TQuery: OperationType>(
38
37
  options?: {|
39
38
  UNSTABLE_renderPolicy?: RenderPolicy,
40
39
  |},
41
- ): $ElementType<TQuery, 'response'> {
40
+ ): TQuery['response'] {
42
41
  // We need to use this hook in order to be able to track if
43
42
  // loadQuery was called during render
44
43
  useTrackLoadQueryInRender();
45
44
 
46
45
  const environment = useRelayEnvironment();
47
- const {
48
- fetchKey,
49
- fetchPolicy,
50
- source,
51
- variables,
52
- networkCacheConfig,
53
- } = preloadedQuery;
46
+ const {fetchKey, fetchPolicy, source, variables, networkCacheConfig} =
47
+ preloadedQuery;
54
48
  const operation = useMemoOperationDescriptor(
55
49
  gqlQuery,
56
50
  variables,
@@ -13,16 +13,9 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const useIsMountedRef = require('./useIsMountedRef');
17
- const useRelayEnvironment = require('./useRelayEnvironment');
18
-
19
- const {loadQuery, useTrackLoadQueryInRender} = require('./loadQuery');
20
- const {useCallback, useEffect, useRef, useState} = require('react');
21
- const {getRequest} = require('relay-runtime');
22
-
23
16
  import type {
24
- PreloadableConcreteRequest,
25
17
  LoadQueryOptions,
18
+ PreloadableConcreteRequest,
26
19
  PreloadedQuery,
27
20
  } from './EntryPointTypes.flow';
28
21
  import type {
@@ -31,8 +24,14 @@ import type {
31
24
  OperationType,
32
25
  } from 'relay-runtime';
33
26
 
27
+ const {loadQuery, useTrackLoadQueryInRender} = require('./loadQuery');
28
+ const useIsMountedRef = require('./useIsMountedRef');
29
+ const useRelayEnvironment = require('./useRelayEnvironment');
30
+ const {useCallback, useEffect, useRef, useState} = require('react');
31
+ const {getRequest} = require('relay-runtime');
32
+
34
33
  export type LoaderFn<TQuery: OperationType> = (
35
- variables: $ElementType<TQuery, 'variables'>,
34
+ variables: TQuery['variables'],
36
35
  options?: UseQueryLoaderLoadQueryOptions,
37
36
  ) => void;
38
37
 
@@ -104,12 +103,10 @@ function useQueryLoader<TQuery: OperationType>(
104
103
  PreloadedQuery<TQuery> | NullQueryReference,
105
104
  >(() => initialQueryReferenceInternal);
106
105
 
107
- const [
108
- previousInitialQueryReference,
109
- setPreviousInitialQueryReference,
110
- ] = useState<PreloadedQuery<TQuery> | NullQueryReference>(
111
- () => initialQueryReferenceInternal,
112
- );
106
+ const [previousInitialQueryReference, setPreviousInitialQueryReference] =
107
+ useState<PreloadedQuery<TQuery> | NullQueryReference>(
108
+ () => initialQueryReferenceInternal,
109
+ );
113
110
 
114
111
  if (initialQueryReferenceInternal !== previousInitialQueryReference) {
115
112
  // Rendering the query reference makes it "managed" by this hook, so
@@ -131,7 +128,7 @@ function useQueryLoader<TQuery: OperationType>(
131
128
 
132
129
  const queryLoaderCallback = useCallback(
133
130
  (
134
- variables: $ElementType<TQuery, 'variables'>,
131
+ variables: TQuery['variables'],
135
132
  options?: ?UseQueryLoaderLoadQueryOptions,
136
133
  ) => {
137
134
  const mergedOptions: ?UseQueryLoaderLoadQueryOptions =
@@ -13,19 +13,18 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const useRefetchableFragmentNode = require('./useRefetchableFragmentNode');
17
- const useStaticFragmentNodeWarning = require('./useStaticFragmentNodeWarning');
18
-
19
- const {useDebugValue} = require('react');
20
- const {getFragment} = require('relay-runtime');
21
-
22
16
  import type {RefetchFnDynamic} from './useRefetchableFragmentNode';
23
17
  import type {
18
+ FragmentType,
24
19
  GraphQLTaggedNode,
25
20
  OperationType,
26
- FragmentReference,
27
21
  } from 'relay-runtime';
28
22
 
23
+ const useRefetchableFragmentNode = require('./useRefetchableFragmentNode');
24
+ const useStaticFragmentNodeWarning = require('./useStaticFragmentNodeWarning');
25
+ const {useDebugValue} = require('react');
26
+ const {getFragment} = require('relay-runtime');
27
+
29
28
  type ReturnType<TQuery: OperationType, TKey: ?{+$data?: mixed, ...}> = [
30
29
  // NOTE: This $Call ensures that the type of the returned data is either:
31
30
  // - nullable if the provided ref type is nullable
@@ -41,7 +40,7 @@ type ReturnType<TQuery: OperationType, TKey: ?{+$data?: mixed, ...}> = [
41
40
 
42
41
  function useRefetchableFragment<
43
42
  TQuery: OperationType,
44
- TKey: ?{+$data?: mixed, +$fragmentRefs: FragmentReference, ...},
43
+ TKey: ?{+$data?: mixed, +$fragmentSpreads: FragmentType, ...},
45
44
  >(
46
45
  fragmentInput: GraphQLTaggedNode,
47
46
  fragmentRef: TKey,
@@ -13,17 +13,27 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const ProfilerContext = require('./ProfilerContext');
16
+ import type {LoaderFn} from './useQueryLoader';
17
+ import type {
18
+ Disposable,
19
+ FetchPolicy,
20
+ IEnvironment,
21
+ OperationDescriptor,
22
+ OperationType,
23
+ ReaderFragment,
24
+ RenderPolicy,
25
+ Variables,
26
+ VariablesOf,
27
+ } from 'relay-runtime';
17
28
 
18
- const invariant = require('invariant');
29
+ const {getFragmentResourceForEnvironment} = require('./FragmentResource');
30
+ const ProfilerContext = require('./ProfilerContext');
31
+ const {getQueryResourceForEnvironment} = require('./QueryResource');
19
32
  const useFragmentNode = require('./useFragmentNode');
20
33
  const useIsMountedRef = require('./useIsMountedRef');
21
34
  const useQueryLoader = require('./useQueryLoader');
22
35
  const useRelayEnvironment = require('./useRelayEnvironment');
23
- const warning = require('warning');
24
-
25
- const {getFragmentResourceForEnvironment} = require('./FragmentResource');
26
- const {getQueryResourceForEnvironment} = require('./QueryResource');
36
+ const invariant = require('invariant');
27
37
  const {useCallback, useContext, useReducer} = require('react');
28
38
  const {
29
39
  __internal: {fetchQuery},
@@ -33,19 +43,7 @@ const {
33
43
  getSelector,
34
44
  getValueAtPath,
35
45
  } = require('relay-runtime');
36
-
37
- import type {LoaderFn} from './useQueryLoader';
38
- import type {
39
- Disposable,
40
- FetchPolicy,
41
- IEnvironment,
42
- OperationDescriptor,
43
- OperationType,
44
- ReaderFragment,
45
- RenderPolicy,
46
- Variables,
47
- VariablesOf,
48
- } from 'relay-runtime';
46
+ const warning = require('warning');
49
47
 
50
48
  export type RefetchFn<
51
49
  TQuery: OperationType,
@@ -176,11 +174,8 @@ function useRefetchableFragmentNode<
176
174
  componentDisplayName: string,
177
175
  ): ReturnType<TQuery, TKey, InternalOptions> {
178
176
  const parentEnvironment = useRelayEnvironment();
179
- const {
180
- refetchableRequest,
181
- fragmentRefPathInResponse,
182
- identifierField,
183
- } = getRefetchMetadata(fragmentNode, componentDisplayName);
177
+ const {refetchableRequest, fragmentRefPathInResponse, identifierField} =
178
+ getRefetchMetadata(fragmentNode, componentDisplayName);
184
179
  const fragmentIdentifier = getFragmentIdentifier(
185
180
  fragmentNode,
186
181
  parentFragmentRef,
@@ -213,9 +208,8 @@ function useRefetchableFragmentNode<
213
208
  const shouldReset =
214
209
  environment !== mirroredEnvironment ||
215
210
  fragmentIdentifier !== mirroredFragmentIdentifier;
216
- const [queryRef, loadQuery, disposeQuery] = useQueryLoader<TQuery>(
217
- refetchableRequest,
218
- );
211
+ const [queryRef, loadQuery, disposeQuery] =
212
+ useQueryLoader<TQuery>(refetchableRequest);
219
213
 
220
214
  let fragmentRef = parentFragmentRef;
221
215
  if (shouldReset) {
@@ -436,7 +430,6 @@ function useRefetchFunction<TQuery: OperationType>(
436
430
  // all variables required by the fragment when calling `refetch()`.
437
431
  // We fill in any variables not passed by the call to `refetch()` with the
438
432
  // variables from the original parent fragment owner.
439
- // $FlowFixMe[cannot-spread-interface]
440
433
  const refetchVariables: VariablesOf<TQuery> = {
441
434
  ...(parentVariables: $FlowFixMe),
442
435
  ...fragmentVariables,
@@ -500,7 +493,7 @@ function useRefetchFunction<TQuery: OperationType>(
500
493
  // - fragmentNode and parentFragmentRef are also captured by including
501
494
  // fragmentIdentifier
502
495
  // eslint-disable-next-line react-hooks/exhaustive-deps
503
- [fragmentIdentifier, dispatch, disposeQuery, identifierValue],
496
+ [fragmentIdentifier, dispatch, disposeQuery, identifierValue, loadQuery],
504
497
  );
505
498
  }
506
499
 
@@ -513,7 +506,6 @@ if (__DEV__) {
513
506
  environment: IEnvironment,
514
507
  ): ?DebugIDandTypename {
515
508
  const {Record} = require('relay-runtime');
516
- // $FlowFixMe[prop-missing]
517
509
  const id = memoRefetchVariables?.id;
518
510
  if (
519
511
  fragmentRefPathInResponse.length !== 1 ||
@@ -13,13 +13,11 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const ReactRelayContext = require('react-relay/ReactRelayContext');
16
+ import type {IEnvironment} from 'relay-runtime';
17
17
 
18
18
  const invariant = require('invariant');
19
-
20
19
  const {useContext} = require('react');
21
-
22
- import type {IEnvironment} from 'relay-runtime';
20
+ const ReactRelayContext = require('react-relay/ReactRelayContext');
23
21
 
24
22
  function useRelayEnvironment(): IEnvironment {
25
23
  const context = useContext(ReactRelayContext);
@@ -13,11 +13,10 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const warning = require('warning');
16
+ import type {ReaderFragment} from 'relay-runtime';
17
17
 
18
18
  const {useRef} = require('react');
19
-
20
- import type {ReaderFragment} from 'relay-runtime';
19
+ const warning = require('warning');
21
20
 
22
21
  function useStaticFragmentNodeWarning(
23
22
  fragmentNode: ReaderFragment,
@@ -13,12 +13,11 @@
13
13
 
14
14
  'use strict';
15
15
 
16
- const useRelayEnvironment = require('./useRelayEnvironment');
16
+ import type {DataID, Disposable, InvalidationState} from 'relay-runtime';
17
17
 
18
+ const useRelayEnvironment = require('./useRelayEnvironment');
18
19
  const {useEffect, useRef} = require('react');
19
20
 
20
- import type {DataID, Disposable, InvalidationState} from 'relay-runtime';
21
-
22
21
  /**
23
22
  * This hook subscribes a callback to the invalidation state of the given data
24
23
  * ids.
@@ -35,9 +34,7 @@ function useSubscribeToInvalidationState(
35
34
  const environment = useRelayEnvironment();
36
35
  const disposableRef = useRef(null);
37
36
 
38
- const stableDataIDs = Array.from(dataIDs)
39
- .sort()
40
- .join('');
37
+ const stableDataIDs = Array.from(dataIDs).sort().join('');
41
38
  useEffect(() => {
42
39
  const store = environment.getStore();
43
40
  const invalidationState = store.lookupInvalidationState(dataIDs);
@@ -12,18 +12,17 @@
12
12
 
13
13
  'use strict';
14
14
 
15
- const useRelayEnvironment = require('./useRelayEnvironment');
16
-
17
- const {useEffect} = require('react');
18
- const {requestSubscription} = require('relay-runtime');
19
-
20
15
  import type {
21
- IEnvironment,
16
+ Disposable,
22
17
  GraphQLSubscriptionConfig,
18
+ IEnvironment,
23
19
  SubscriptionParameters,
24
- Disposable,
25
20
  } from 'relay-runtime';
26
21
 
22
+ const useRelayEnvironment = require('./useRelayEnvironment');
23
+ const {useEffect} = require('react');
24
+ const {requestSubscription} = require('relay-runtime');
25
+
27
26
  type RequestSubscriptionFn<TSubscriptionParameters: SubscriptionParameters> = (
28
27
  environment: IEnvironment,
29
28
  config: GraphQLSubscriptionConfig<TSubscriptionParameters>,