Skip to content

Commit 886c5ad

Browse files
authored
Reduce risk of leaving shipped Hooks as nullable on Dispatcher (#32068)
1 parent f0edf41 commit 886c5ad

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/react-reconciler/src/ReactInternalTypes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,9 @@ export type Dispatcher = {
394394
create: () => (() => void) | void,
395395
deps: Array<mixed> | void | null,
396396
): void,
397+
// TODO: Non-nullable once `enableUseEffectEventHook` is on everywhere.
397398
useEffectEvent?: <Args, F: (...Array<Args>) => mixed>(callback: F) => F,
399+
// TODO: Non-nullable once `enableUseResourceEffectHook` is on everywhere.
398400
useResourceEffect?: (
399401
create: () => mixed,
400402
createDeps: Array<mixed> | void | null,
@@ -429,7 +431,7 @@ export type Dispatcher = {
429431
getServerSnapshot?: () => T,
430432
): T,
431433
useId(): string,
432-
useCacheRefresh?: () => <T>(?() => T, ?T) => void,
434+
useCacheRefresh: () => <T>(?() => T, ?T) => void,
433435
useMemoCache: (size: number) => Array<any>,
434436
useHostTransitionStatus: () => TransitionStatus,
435437
useOptimistic: <S, A>(

packages/react-server/src/ReactFizzHooks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ export const HooksDispatcher: Dispatcher = supportsClientAPIs
835835
useFormState: useActionState,
836836
useHostTransitionStatus,
837837
useMemoCache,
838+
useCacheRefresh,
838839
}
839840
: {
840841
readContext,

0 commit comments

Comments
 (0)