Skip to content

Commit

Permalink
Reduce risk of leaving shipped Hooks as nullable on Dispatcher (faceb…
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored Jan 14, 2025
1 parent f0edf41 commit 886c5ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/react-reconciler/src/ReactInternalTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,9 @@ export type Dispatcher = {
create: () => (() => void) | void,
deps: Array<mixed> | void | null,
): void,
// TODO: Non-nullable once `enableUseEffectEventHook` is on everywhere.
useEffectEvent?: <Args, F: (...Array<Args>) => mixed>(callback: F) => F,
// TODO: Non-nullable once `enableUseResourceEffectHook` is on everywhere.
useResourceEffect?: (
create: () => mixed,
createDeps: Array<mixed> | void | null,
Expand Down Expand Up @@ -429,7 +431,7 @@ export type Dispatcher = {
getServerSnapshot?: () => T,
): T,
useId(): string,
useCacheRefresh?: () => <T>(?() => T, ?T) => void,
useCacheRefresh: () => <T>(?() => T, ?T) => void,
useMemoCache: (size: number) => Array<any>,
useHostTransitionStatus: () => TransitionStatus,
useOptimistic: <S, A>(
Expand Down
1 change: 1 addition & 0 deletions packages/react-server/src/ReactFizzHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ export const HooksDispatcher: Dispatcher = supportsClientAPIs
useFormState: useActionState,
useHostTransitionStatus,
useMemoCache,
useCacheRefresh,
}
: {
readContext,
Expand Down

0 comments on commit 886c5ad

Please sign in to comment.