Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix <Popover.Button as={Fragment} /> crash #1889

Merged
merged 2 commits into from Sep 30, 2022
Merged

Conversation

RobinMalfait
Copy link
Collaborator

This PR fixes a crash when using as={Fragment} on the Popover.Button component.

When you use as={Fragment} an unmount and remount can happen. This means that the ref gets called with null for the unmount and HTMLButtonElement for the mount.

This keeps toggling which results in an infinite loop and eventually a Maximum callback size exceeded issue.

This ensures that we only set the button if we have a button.

Fixes: #1888

When you use `as={Fragment}` an unmount and remount can happen. This
means that the `ref` gets called with `null` for the unmount and
`HTMLButtonElement` for the mount.

This keeps toggling which results in an infinite loop and eventually a
Maximum callback size exceeded issue.

This ensures that we only set the button if we have a button.
@vercel
Copy link

vercel bot commented Sep 30, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
headlessui-react ✅ Ready (Inspect) Visit Preview Sep 30, 2022 at 7:44PM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview Sep 30, 2022 at 7:44PM (UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maximum update depth exceeded when using Fragment on Popover.Button
1 participant