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

immediate prop does not work well in React 18.2 #3659

Open
krzykro2 opened this issue Feb 25, 2025 · 0 comments
Open

immediate prop does not work well in React 18.2 #3659

krzykro2 opened this issue Feb 25, 2025 · 0 comments

Comments

@krzykro2
Copy link

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

2.2.0

What browser are you using?

Chrome

Reproduction URL

https://codesandbox.io/p/sandbox/rvmjcv

Describe your issue

Changing the immediate prop on the Combobox does not immediately reflect behavior change. If the component is initiated with immediate={false}, and then its prop value changes to true then it will still not show the options on focus, until something is typed in. Afterwards, the component behaves correctly (e.g. if the input is cleared and the focus is released, next time the component receives focus it will correctly show the options).

Only reproducible in React 18.2. Updating the immediate prop seems to work correctly in React 19.

In the attached example the component should behave with the behavior of immediate={true} (as it's set to true in the first useEffect cycle), but instead it behaves as if immediate was set to false, until something is typed in.

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

No branches or pull requests

1 participant