diff --git a/.changeset/react-compiler-tooltip-v2.md b/.changeset/react-compiler-tooltip-v2.md new file mode 100644 index 00000000000..9181f409f21 --- /dev/null +++ b/.changeset/react-compiler-tooltip-v2.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Tooltip: Improve rendering performance with React Compiler support diff --git a/packages/react/script/react-compiler.mjs b/packages/react/script/react-compiler.mjs index 184c468cfc0..4198b0a6a24 100644 --- a/packages/react/script/react-compiler.mjs +++ b/packages/react/script/react-compiler.mjs @@ -40,7 +40,6 @@ const unsupportedPatterns = [ 'src/hooks/useScrollFlash.ts', 'src/internal/components/CheckboxOrRadioGroup/**/*.tsx', 'src/hooks/useMergedRefs.ts', - 'src/TooltipV2/**/*.tsx', ] const unsupported = new Set( diff --git a/packages/react/src/TooltipV2/__tests__/Tooltip.test.tsx b/packages/react/src/TooltipV2/__tests__/Tooltip.test.tsx index c87f32e59a5..6ee91eb38b6 100644 --- a/packages/react/src/TooltipV2/__tests__/Tooltip.test.tsx +++ b/packages/react/src/TooltipV2/__tests__/Tooltip.test.tsx @@ -29,8 +29,11 @@ const TooltipComponentWithExistingDescription = (props: Omit ) -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function ExampleWithActionMenu(actionMenuTrigger: React.ReactElement): JSX.Element { +interface ExampleWithActionMenuProps { + actionMenuTrigger: React.ReactElement +} + +function ExampleWithActionMenu({actionMenuTrigger}: ExampleWithActionMenuProps): JSX.Element { return ( @@ -82,11 +85,13 @@ describe('Tooltip', () => { it('should spread the accessibility attributes correctly on the trigger (ActionMenu.Button) when tooltip is used in an action menu', () => { const {getByRole, getByText} = HTMLRender( - ExampleWithActionMenu( - - Toggle Menu - , - ), + + Toggle Menu + + } + />, ) const menuButton = getByRole('button') const tooltip = getByText('Additional context about the menu button') @@ -96,13 +101,15 @@ describe('Tooltip', () => { it('should spread the accessibility attributes correctly on the trigger (Button) when tooltip is used in an action menu', () => { const {getByRole, getByText} = HTMLRender( - ExampleWithActionMenu( - - - - - , - ), + + + + + + } + />, ) const menuButton = getByRole('button') const tooltip = getByText('Additional context about the menu button')