react-relay 0.0.0-main-0d20d162 → 0.0.0-main-bd5c9e5b

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-0d20d162
2
+ * Relay v0.0.0-main-bd5c9e5b
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/hooks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-0d20d162
2
+ * Relay v0.0.0-main-bd5c9e5b
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-0d20d162
2
+ * Relay v0.0.0-main-bd5c9e5b
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
package/legacy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Relay v0.0.0-main-0d20d162
2
+ * Relay v0.0.0-main-bd5c9e5b
3
3
  *
4
4
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
5
  *
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-0d20d162",
4
+ "version": "0.0.0-main-bd5c9e5b",
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-0d20d162"
23
+ "relay-runtime": "0.0.0-main-bd5c9e5b"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "react": "^16.9.0 || ^17 || ^18 || ^19"
@@ -126,37 +126,21 @@ Every .entrypoint file it's an object that must have two required fields:
126
126
  TEntryPointParams - object that contains all necessary information to execute
127
127
  the preloaders (routeParams, query variables)
128
128
 
129
- TPreloadedQueries - queries, defined in the root components
130
-
131
- TPreloadedEntryPoints - nested entry points, defined in the root components
132
-
133
- TRuntimeProps - the type of additional props that you may pass to the
134
- component (like `onClick` handler, etc) during runtime. Values for them
135
- defined during component runtime
136
-
137
- TExtraProps - a bag of extra props that you may define in `entrypoint` file
138
- and they will be passed to the EntryPointComponent as `extraProps`
129
+ TEntryPointComponent - the root components
139
130
  */
140
- export type InternalEntryPointRepresentation<
141
- TEntryPointParams,
142
- TPreloadedQueries,
143
- TPreloadedEntryPoints = {...},
144
- TRuntimeProps = {...},
145
- TExtraProps = null,
146
- +TRenders: React.Node = React.Node,
131
+ export type EntryPoint<
132
+ -TEntryPointParams,
133
+ // $FlowExpectedError[unclear-type] accepts any root component
134
+ +TEntryPointComponent: EntryPointComponent<any, any, any, any, any>,
147
135
  > = $ReadOnly<{
148
136
  getPreloadProps: (
149
137
  entryPointParams: TEntryPointParams,
150
- ) => PreloadProps<TPreloadedQueries, TPreloadedEntryPoints, TExtraProps>,
151
- root: JSResourceReference<
152
- EntryPointComponent<
153
- TPreloadedQueries,
154
- TPreloadedEntryPoints,
155
- TRuntimeProps,
156
- TExtraProps,
157
- TRenders,
158
- >,
138
+ ) => PreloadProps<
139
+ ElementConfig<TEntryPointComponent>['queries'],
140
+ ElementConfig<TEntryPointComponent>['entryPoints'],
141
+ ElementConfig<TEntryPointComponent>['extraProps'],
159
142
  >,
143
+ root: JSResourceReference<TEntryPointComponent>,
160
144
  }>;
161
145
 
162
146
  // The shape of the props of the entry point `root` component
@@ -172,7 +156,23 @@ export type EntryPointProps<
172
156
  queries: TPreloadedQueries,
173
157
  }>;
174
158
 
175
- // Type of the entry point `root` component
159
+ /**
160
+ Type of the entry point `root` component
161
+
162
+ TEntryPointParams - object that contains all necessary information to execute
163
+ the preloaders (routeParams, query variables)
164
+
165
+ TPreloadedQueries - queries, defined in the root components
166
+
167
+ TPreloadedEntryPoints - nested entry points, defined in the root components
168
+
169
+ TRuntimeProps - the type of additional props that you may pass to the
170
+ component (like `onClick` handler, etc) during runtime. Values for them
171
+ defined during component runtime
172
+
173
+ TExtraProps - a bag of extra props that you may define in `entrypoint` file
174
+ and they will be passed to the EntryPointComponent as `extraProps`
175
+ */
176
176
  export type EntryPointComponent<
177
177
  TPreloadedQueries,
178
178
  TPreloadedEntryPoints = {},
@@ -215,21 +215,18 @@ export type PreloadedEntryPoint<TEntryPointComponent> = $ReadOnly<{
215
215
  }>;
216
216
 
217
217
  export type EntryPointElementConfig<
218
- // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
219
- +TEntryPoint: InternalEntryPointRepresentation<any, any, any, any, any>,
220
- > =
221
- TEntryPoint extends InternalEntryPointRepresentation<
218
+ +TEntryPoint: EntryPoint<
222
219
  // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
223
220
  any,
224
221
  // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
225
222
  any,
226
- // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
227
- any,
228
- infer Props,
229
- // $FlowExpectedError[unclear-type] Need any to make it supertype of all InternalEntryPointRepresentation
230
- any,
223
+ >,
224
+ > =
225
+ TEntryPoint extends EntryPoint<
226
+ infer _EntryPointParams,
227
+ infer EntryPointComponent,
231
228
  >
232
- ? Props
229
+ ? ElementConfig<EntryPointComponent>['props']
233
230
  : empty;
234
231
 
235
232
  export type ThinQueryParams<
@@ -280,20 +277,10 @@ export type ExtractQueryTypes<
280
277
  };
281
278
 
282
279
  // $FlowFixMe[unclear-type]: we don't care about the props
283
- type Renders<+C: component(...any)> =
280
+ export type RootComponentRenders<+C: component(...any)> =
284
281
  // $FlowFixMe[unclear-type]: we don't care about the props
285
282
  C extends component(...any) renders infer R extends React.Node ? R : empty;
286
283
 
287
- export type EntryPoint<TEntryPointParams, +TEntryPointComponent> =
288
- InternalEntryPointRepresentation<
289
- TEntryPointParams,
290
- ElementConfig<TEntryPointComponent>['queries'],
291
- ElementConfig<TEntryPointComponent>['entryPoints'],
292
- ElementConfig<TEntryPointComponent>['props'],
293
- ElementConfig<TEntryPointComponent>['extraProps'],
294
- Renders<TEntryPointComponent>,
295
- >;
296
-
297
284
  export type PreloadParamsOf<T> = Parameters<T['getPreloadProps']>[0];
298
285
 
299
286
  export type IEnvironmentProvider<TOptions> = $ReadOnly<{
@@ -136,6 +136,7 @@ function prepareEntryPoint<
136
136
  });
137
137
  }
138
138
  return {
139
+ // $FlowFixMe[incompatible-type]
139
140
  entryPoints: preloadedEntryPoints as TPreloadedEntryPoints,
140
141
  extraProps: extraProps ?? null,
141
142
  getComponent: () => {
@@ -147,6 +148,7 @@ function prepareEntryPoint<
147
148
  // $FlowFixMe[incompatible-type] - trust me Flow, its entryPoint component
148
149
  return component as TEntryPointComponent;
149
150
  },
151
+ // $FlowFixMe[incompatible-type]
150
152
  queries: preloadedQueries as TPreloadedQueries,
151
153
  rootModuleID: entryPoint.root.getModuleId(),
152
154
  };
@@ -12,7 +12,7 @@
12
12
  'use strict';
13
13
 
14
14
  import type {
15
- InternalEntryPointRepresentation,
15
+ EntryPoint,
16
16
  ThinNestedEntryPointParams,
17
17
  } from './EntryPointTypes.flow';
18
18
 
@@ -26,13 +26,7 @@ import type {
26
26
  */
27
27
  declare function NestedRelayEntryPoint<TEntryPointParams>(
28
28
  $ReadOnly<{
29
- entryPoint: InternalEntryPointRepresentation<
30
- TEntryPointParams,
31
- $FlowFixMe,
32
- $FlowFixMe,
33
- $FlowFixMe,
34
- $FlowFixMe,
35
- >,
29
+ entryPoint: EntryPoint<TEntryPointParams, $FlowFixMe>,
36
30
  entryPointParams: TEntryPointParams,
37
31
  }>,
38
32
  ): ThinNestedEntryPointParams;
@@ -143,6 +143,7 @@ hook useBlockingPaginationFragment<
143
143
  disposeFetchNext();
144
144
  disposeFetchPrevious();
145
145
  // $FlowFixMe[incompatible-variance]
146
+ // $FlowFixMe[incompatible-type]
146
147
  return refetch(variables, {...options, __environment: undefined});
147
148
  },
148
149
  [disposeFetchNext, disposeFetchPrevious, refetch],
@@ -130,6 +130,7 @@ function loadEntryPoint<
130
130
  }
131
131
  isDisposed = true;
132
132
  },
133
+ // $FlowFixMe[incompatible-type]
133
134
  entryPoints: preloadedEntryPoints as TPreloadedEntryPoints,
134
135
  extraProps: extraProps ?? null,
135
136
  getComponent: () => {
@@ -155,6 +156,7 @@ function loadEntryPoint<
155
156
  get isDisposed() {
156
157
  return isDisposed;
157
158
  },
159
+ // $FlowFixMe[incompatible-type]
158
160
  queries: preloadedQueries as TPreloadedQueries,
159
161
  rootModuleID: entryPoint.root.getModuleId(),
160
162
  };
@@ -68,6 +68,7 @@ hook useLoadMoreFunction<TVariables: Variables>(
68
68
  if (RelayFeatureFlags.ENABLE_ACTIVITY_COMPATIBILITY) {
69
69
  // $FlowFixMe[react-rule-hook] - the condition is static
70
70
  // $FlowFixMe[react-rule-hook-conditional]
71
+ // $FlowFixMe[incompatible-type]
71
72
  return useLoadMoreFunction_EXPERIMENTAL(args);
72
73
  }
73
74
  // $FlowFixMe[react-rule-hook] - the condition is static
@@ -163,6 +163,7 @@ hook usePaginationFragment<
163
163
  hasPrevious,
164
164
  isLoadingNext,
165
165
  isLoadingPrevious,
166
+ // $FlowFixMe[incompatible-type]
166
167
  refetch: refetchPagination,
167
168
  };
168
169
  }
@@ -429,6 +429,7 @@ hook usePrefetchableForwardPaginationFragment<
429
429
  // Only reflect `isLoadingMore` if the product depends on it, do not refelect
430
430
  // `isLoaindgMore` state if it is for fufilling the buffer
431
431
  isLoadingNext: isLoadingMore && numInUse > sourceSize,
432
+ // $FlowFixMe[incompatible-type]
432
433
  refetch: refetchPagination,
433
434
  };
434
435
  }
@@ -428,6 +428,7 @@ hook usePrefetchableForwardPaginationFragment_EXPERIMENTAL<
428
428
  // Only reflect `isLoadingMore` if the product depends on it, do not refelect
429
429
  // `isLoaindgMore` state if it is for fufilling the buffer
430
430
  isLoadingNext: isLoadingMore && numInUse > sourceSize,
431
+ // $FlowFixMe[incompatible-type]
431
432
  refetch: refetchPagination,
432
433
  };
433
434
  }