Skip to content

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 GitHub.

Project Deployment Preview Comments Updated (UTC)
headlessui-react Ready Ready Preview Comment Sep 25, 2025 1:20pm
headlessui-vue Ready Ready Preview Comment Sep 25, 2025 1:20pm

@thecrypticace thecrypticace changed the title Ensure ref are forwarded when freezing data Ensure refs are forwarded when freezing data Jul 17, 2024
@augustl
Copy link

augustl commented Oct 24, 2024

So, really sorry to be "that guy" (tbh, Github needs a "donate money here before you pester the open source maintainers" button), but is there anything I can help out with in order to get this one merged? :)

@RobinMalfait RobinMalfait force-pushed the fix/frozen-forward-refs branch from 7c3ce5c to 408540f Compare September 25, 2025 13:19
@RobinMalfait RobinMalfait merged commit 2a647a7 into main Sep 25, 2025
8 checks passed
@RobinMalfait RobinMalfait deleted the fix/frozen-forward-refs branch September 25, 2025 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants