Skip to content

Commit

Permalink
fix infinite loop when using <MenuButton as={Fragment}>
Browse files Browse the repository at this point in the history
Fixes: #3476
Fixes: #3439
  • Loading branch information
RobinMalfait committed Sep 12, 2024
1 parent dde00da commit 7b8f5f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/@headlessui-react/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import {
forwardRefWithAs,
mergeProps,
render,
useMergeRefsFn,
type HasDisplayName,
type RefProp,
} from '../../utils/render'
Expand Down Expand Up @@ -483,6 +484,7 @@ function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(
} = props
let [state, dispatch] = useMenuContext('Menu.Button')
let getFloatingReferenceProps = useFloatingReferenceProps()
let mergeRefs = useMergeRefsFn()
let buttonRef = useSyncRefs(
ref,
useFloatingReference(),
Expand Down Expand Up @@ -570,6 +572,7 @@ function ButtonFn<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(
)

return render({
mergeRefs,
ourProps,
theirProps,
slot,
Expand Down

0 comments on commit 7b8f5f1

Please sign in to comment.