Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/react/src/Popover/Popover.features.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Meta, StoryFn} from '@storybook/react-vite'
import type {Meta} from '@storybook/react-vite'
import Heading from '../Heading'
import Popover from './Popover'
import Text from '../Text'
Expand Down
5 changes: 4 additions & 1 deletion packages/react/src/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import type {HTMLProps} from 'react'
import React, {useRef} from 'react'
import {useOnOutsideClick} from '../hooks'

// Stable empty array reference to avoid unnecessary re-renders
const EMPTY_IGNORE_CLICK_REFS: React.RefObject<HTMLElement>[] = []

type CaretPosition =
| 'top'
| 'bottom'
Expand Down Expand Up @@ -75,7 +78,7 @@ const PopoverContent: React.FC<React.PropsWithChildren<PopoverContentProps>> = (
useOnOutsideClick({
onClickOutside: onClickOutside ?? (() => null),
containerRef: divRef,
ignoreClickRefs: ignoreClickRefs ?? [],
ignoreClickRefs: ignoreClickRefs ?? EMPTY_IGNORE_CLICK_REFS,
})

return (
Expand Down