@samitouri / QOS-React-2 / commits / 7baae65e76

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`.

Sol Lee committed Jun 26, 2024 at 22:59 UTC 7baae65e767726e44a23c13203c05ae0d540e26f
2 files changed +2 -1
compiler/packages/babel-plugin-react-compiler/src/HIR/Globals.ts
+1 -1
@@ -363,7 +363,7 @@ const REACT_APIS: Array<[string, BuiltInType]> = [
363 restParam: Effect.Freeze,
364 returnType: { kind: "Poly" },
365 calleeEffect: Effect.Read,
366 - hookKind: "useLayoutEffect",
366 + hookKind: "useInsertionEffect",
367 returnValueKind: ValueKind.Frozen,
368 },
369 BuiltInUseInsertionEffectHookId
compiler/packages/babel-plugin-react-compiler/src/HIR/ObjectShape.ts
+1
@@ -123,6 +123,7 @@ export type HookKind =
123 | "useRef"
124 | "useEffect"
125 | "useLayoutEffect"
126 + | "useInsertionEffect"
127 | "useMemo"
128 | "useCallback"
129 | "Custom";