From 3e1f64533b7624685668b55c4fa54a262919a8a9 Mon Sep 17 00:00:00 2001 From: Saul Lee Date: Tue, 25 Jun 2024 02:24:53 +0900 Subject: [PATCH] compiler: fix the `hookKind` of `useInsertionEffect` --- .../packages/babel-plugin-react-compiler/src/HIR/Globals.ts | 2 +- .../packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts index 1c471930f620d..ae7079a6c53e4 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts @@ -363,7 +363,7 @@ const REACT_APIS: Array<[string, BuiltInType]> = [ restParam: Effect.Freeze, returnType: { kind: "Poly" }, calleeEffect: Effect.Read, - hookKind: "useLayoutEffect", + hookKind: "useInsertionEffect", returnValueKind: ValueKind.Frozen, }, BuiltInUseInsertionEffectHookId diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts index 0a3451023cd4c..e0885a49b6aae 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts @@ -123,6 +123,7 @@ export type HookKind = | "useRef" | "useEffect" | "useLayoutEffect" + | "useInsertionEffect" | "useMemo" | "useCallback" | "Custom";