Skip to content

Commit e35da38

Browse files
committed
[Fizz] Support useMemoCache in renderers with support for Client APIs
Mainly an oversight since we don't have types based off of feature flags. Now that `enableUseMemoCache` is shipped, `useMemoCache` can be non-nullable. Discovered during integration testing with Next.js where SSR threw with `TypeError: dispatcher.useMemoCache is not a function` but ultimately recovered due to client-side rendering.
1 parent b3a95ca commit e35da38

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

packages/react-reconciler/src/ReactInternalTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export type Dispatcher = {
430430
): T,
431431
useId(): string,
432432
useCacheRefresh?: () => <T>(?() => T, ?T) => void,
433-
useMemoCache?: (size: number) => Array<any>,
433+
useMemoCache: (size: number) => Array<any>,
434434
useHostTransitionStatus: () => TransitionStatus,
435435
useOptimistic: <S, A>(
436436
passthrough: S,

packages/react-server/src/ReactFizzHooks.js

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

0 commit comments

Comments
 (0)