Skip to content

Commit 7baae65

Browse files
compiler: fix the hookKind for useInsertionEffect (#30069)
Currently, the `hookKind` for `useInsertionEffect` is set to `useLayoutEffect`. This pull request fixes it by adding a new `hookKind` for `useInsertionEffect`.
1 parent bbc8851 commit 7baae65

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ const REACT_APIS: Array<[string, BuiltInType]> = [
363363
restParam: Effect.Freeze,
364364
returnType: { kind: "Poly" },
365365
calleeEffect: Effect.Read,
366-
hookKind: "useLayoutEffect",
366+
hookKind: "useInsertionEffect",
367367
returnValueKind: ValueKind.Frozen,
368368
},
369369
BuiltInUseInsertionEffectHookId

compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export type HookKind =
123123
| "useRef"
124124
| "useEffect"
125125
| "useLayoutEffect"
126+
| "useInsertionEffect"
126127
| "useMemo"
127128
| "useCallback"
128129
| "Custom";

0 commit comments

Comments
 (0)