From f2fe7ee57478f74a4c9cd3b883efbec17ecf5b2b Mon Sep 17 00:00:00 2001 From: hectahertz Date: Thu, 12 Feb 2026 20:58:08 +0100 Subject: [PATCH] perf(ActionList): enable React Compiler - Remove ActionList from the React Compiler unsupported list - Fix Rules of Hooks violation in ChildWithSideEffects story by moving SideEffectDescription to module scope --- packages/react/script/react-compiler.mjs | 1 - .../ActionList.features.stories.tsx | 24 +++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/react/script/react-compiler.mjs b/packages/react/script/react-compiler.mjs index b365d389ed2..59912d6a417 100644 --- a/packages/react/script/react-compiler.mjs +++ b/packages/react/script/react-compiler.mjs @@ -13,7 +13,6 @@ const files = glob }) const unsupported = new Set( [ - 'src/ActionList/**/*.tsx', 'src/ActionMenu/**/*.tsx', 'src/AvatarStack/**/*.tsx', 'src/Button/**/*.tsx', diff --git a/packages/react/src/ActionList/ActionList.features.stories.tsx b/packages/react/src/ActionList/ActionList.features.stories.tsx index f6ba7c01abe..6b2afaae3e2 100644 --- a/packages/react/src/ActionList/ActionList.features.stories.tsx +++ b/packages/react/src/ActionList/ActionList.features.stories.tsx @@ -667,21 +667,21 @@ export const ConditionalChildren = () => { ) } -export const ChildWithSideEffects = () => { - const user = users[0] - const [selected, setSelected] = React.useState(true) +const SideEffectDescription = () => { + const [seconds, setSeconds] = React.useState(0) - const SideEffectDescription = () => { - const [seconds, setSeconds] = React.useState(0) + React.useEffect(() => { + const fn = () => setSeconds(s => s + 1) + const interval = window.setInterval(fn, 1000) + return () => window.clearInterval(interval) + }, []) - React.useEffect(() => { - const fn = () => setSeconds(s => s + 1) - const interval = window.setInterval(fn, 1000) - return () => window.clearInterval(interval) - }, []) + return <>{seconds} seconds passed +} - return <>{seconds} seconds passed - } +export const ChildWithSideEffects = () => { + const user = users[0] + const [selected, setSelected] = React.useState(true) return (