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

Ensure refs are forwarded when freezing data #3390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thecrypticace
Copy link
Contributor

We were wrapping rendered children in <Frozen> in a combobox however the refs weren't being forwarded through the internal <Frozen> component resulting in issues when rendering <ComboboxOptions> as a Fragment.

After this PR the following code no longer warns about function components not accepting refs.

import { Combobox, ComboboxInput, ComboboxOption, ComboboxOptions } from '@headlessui/react'
import React from 'react'

export default function Example() {
  return (
    <div className="p-4">
      <Combobox>
        <ComboboxInput className="rounded border border-neutral-400 p-2" />
        <ComboboxOptions as={React.Fragment}>
          <div className="bg-orange-500 p-4">
            <ComboboxOption value="a">A</ComboboxOption>
          </div>
        </ComboboxOptions>
      </Combobox>
    </div>
  )
}

Fixes #3384

Copy link

vercel bot commented Jul 17, 2024

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

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 4:24pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 4:24pm

@thecrypticace thecrypticace changed the title Ensure ref are forwarded when freezing data Ensure refs are forwarded when freezing data Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant