react-relay 0.0.0-main-3c6d7724 → 0.0.0-main-18177f69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReactRelayContext.js +1 -1
- package/hooks.d.ts +2 -0
- package/hooks.js +1 -1
- package/index.js +1 -1
- package/legacy.js +1 -1
- package/package.json +2 -2
- package/relay-hooks/RelayEnvironmentProvider.d.ts +2 -0
- package/relay-hooks/useMutationAction_EXPERIMENTAL.d.ts +16 -0
- package/relay-hooks/usePrefetchableForwardPaginationFragment.d.ts +69 -0
- package/rsc-client_EXPERIMENTAL.js +1 -1
- package/rsc_EXPERIMENTAL.js +1 -1
package/ReactRelayContext.js
CHANGED
package/hooks.d.ts
CHANGED
|
@@ -80,7 +80,9 @@ export { useEntryPointLoader } from './relay-hooks/useEntryPointLoader';
|
|
|
80
80
|
export { useFragment } from './relay-hooks/useFragment';
|
|
81
81
|
export { useLazyLoadQuery } from './relay-hooks/useLazyLoadQuery';
|
|
82
82
|
export { useMutation } from './relay-hooks/useMutation';
|
|
83
|
+
export { useMutationAction_EXPERIMENTAL } from './relay-hooks/useMutationAction_EXPERIMENTAL';
|
|
83
84
|
export { usePaginationFragment } from './relay-hooks/usePaginationFragment';
|
|
85
|
+
export { usePrefetchableForwardPaginationFragment } from './relay-hooks/usePrefetchableForwardPaginationFragment';
|
|
84
86
|
export { usePreloadedQuery } from './relay-hooks/usePreloadedQuery';
|
|
85
87
|
export { useQueryLoader } from './relay-hooks/useQueryLoader';
|
|
86
88
|
export { useRefetchableFragment } from './relay-hooks/useRefetchableFragment';
|
package/hooks.js
CHANGED
package/index.js
CHANGED
package/legacy.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-relay",
|
|
3
3
|
"description": "A framework for building GraphQL-driven React applications.",
|
|
4
|
-
"version": "0.0.0-main-
|
|
4
|
+
"version": "0.0.0-main-18177f69",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
7
7
|
"relay",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"fbjs": "^3.0.2",
|
|
21
21
|
"invariant": "^2.2.4",
|
|
22
22
|
"nullthrows": "^1.1.1",
|
|
23
|
-
"relay-runtime": "0.0.0-main-
|
|
23
|
+
"relay-runtime": "0.0.0-main-18177f69"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"react": "^16.9.0 || ^17 || ^18 || ^19"
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import {ProviderProps, ReactElement, ReactNode} from 'react';
|
|
9
9
|
import {IEnvironment, RelayContext} from 'relay-runtime';
|
|
10
|
+
import {ActorIdentifier, IActorEnvironment} from 'relay-runtime/multi-actor-environment/index';
|
|
10
11
|
|
|
11
12
|
export interface Props {
|
|
12
13
|
children: ReactNode;
|
|
13
14
|
environment: IEnvironment;
|
|
15
|
+
getEnvironmentForActor?: ((actorIdentifier: ActorIdentifier) => IActorEnvironment) | null | undefined;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export function RelayEnvironmentProvider(props: Props): ReactElement<ProviderProps<RelayContext>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
|
|
8
|
+
import {GraphQLTaggedNode, OperationType, VariablesOf} from 'relay-runtime';
|
|
9
|
+
|
|
10
|
+
// Constrained to `OperationType` (response: unknown), not `MutationParameters`
|
|
11
|
+
// (response: Record<string, unknown>): the Flow source places no constraint on
|
|
12
|
+
// the response/`TData`, and the stricter bag rejects `@catch` mutations whose
|
|
13
|
+
// response is a `Result<…>` union. This also matches the other modern hooks.
|
|
14
|
+
export function useMutationAction_EXPERIMENTAL<TMutation extends OperationType>(
|
|
15
|
+
mutation: GraphQLTaggedNode,
|
|
16
|
+
): (variables: VariablesOf<TMutation>) => Promise<TMutation['response']>;
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
|
|
8
|
+
import {KeyType, KeyTypeData, RefetchFnDynamic} from '../ReactRelayTypes';
|
|
9
|
+
import {LoadMoreFn} from './useLoadMoreFunction';
|
|
10
|
+
import {GraphQLTaggedNode, OperationType, VariablesOf} from 'relay-runtime';
|
|
11
|
+
|
|
12
|
+
export interface usePrefetchableForwardPaginationFragmentHookType<
|
|
13
|
+
TQuery extends OperationType,
|
|
14
|
+
TKey extends KeyType | null | undefined,
|
|
15
|
+
TFragmentData,
|
|
16
|
+
TEdgeData,
|
|
17
|
+
> {
|
|
18
|
+
data: TFragmentData;
|
|
19
|
+
loadNext: LoadMoreFn<TQuery>;
|
|
20
|
+
hasNext: boolean;
|
|
21
|
+
isLoadingNext: boolean;
|
|
22
|
+
refetch: RefetchFnDynamic<TQuery, TKey>;
|
|
23
|
+
edges: TEdgeData;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type GetExtraVariablesFn<TQuery extends OperationType, TFragmentData, TEdgeData> = (args: {
|
|
27
|
+
hasNext: boolean;
|
|
28
|
+
data: TFragmentData;
|
|
29
|
+
getServerEdges: () => TEdgeData;
|
|
30
|
+
}) => Partial<VariablesOf<TQuery>>;
|
|
31
|
+
|
|
32
|
+
export interface PrefetchingLoadMoreOptions<TQuery extends OperationType, TFragmentData, TEdgeData> {
|
|
33
|
+
UNSTABLE_extraVariables?:
|
|
34
|
+
| Partial<VariablesOf<TQuery>>
|
|
35
|
+
| GetExtraVariablesFn<TQuery, TFragmentData, TEdgeData>
|
|
36
|
+
| undefined;
|
|
37
|
+
onComplete?: ((error: Error | null) => void) | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function usePrefetchableForwardPaginationFragment<
|
|
41
|
+
TQuery extends OperationType,
|
|
42
|
+
TKey extends KeyType,
|
|
43
|
+
TEdgeData,
|
|
44
|
+
>(
|
|
45
|
+
fragmentInput: GraphQLTaggedNode,
|
|
46
|
+
parentFragmentRef: TKey,
|
|
47
|
+
bufferSize: number,
|
|
48
|
+
initialSize?: number | null | undefined,
|
|
49
|
+
prefetchingLoadMoreOptions?: PrefetchingLoadMoreOptions<TQuery, KeyTypeData<TKey>, TEdgeData>,
|
|
50
|
+
minimalFetchSize?: number,
|
|
51
|
+
disablePrefetching?: boolean,
|
|
52
|
+
): usePrefetchableForwardPaginationFragmentHookType<TQuery, TKey, KeyTypeData<TKey>, TEdgeData>;
|
|
53
|
+
export function usePrefetchableForwardPaginationFragment<
|
|
54
|
+
TQuery extends OperationType,
|
|
55
|
+
TKey extends KeyType,
|
|
56
|
+
TEdgeData,
|
|
57
|
+
>(
|
|
58
|
+
fragmentInput: GraphQLTaggedNode,
|
|
59
|
+
parentFragmentRef: TKey | null | undefined,
|
|
60
|
+
bufferSize: number,
|
|
61
|
+
initialSize?: number | null | undefined,
|
|
62
|
+
prefetchingLoadMoreOptions?: PrefetchingLoadMoreOptions<
|
|
63
|
+
TQuery,
|
|
64
|
+
KeyTypeData<TKey> | null | undefined,
|
|
65
|
+
TEdgeData
|
|
66
|
+
>,
|
|
67
|
+
minimalFetchSize?: number,
|
|
68
|
+
disablePrefetching?: boolean,
|
|
69
|
+
): usePrefetchableForwardPaginationFragmentHookType<TQuery, TKey | null, KeyTypeData<TKey> | null | undefined, TEdgeData>;
|
package/rsc_EXPERIMENTAL.js
CHANGED