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 crash in Combobox component when in virtual mode when options are empty #3356

Merged
merged 3 commits into from
Jul 2, 2024

Conversation

RobinMalfait
Copy link
Member

This PR fixes an issue where using @tanstack/react-virtual with an empty array could lead to crashes such as:

Error: Unexpected undefined

Providing an empty array can happen if you filter the options based on the value of the ComboboxInput.

This PR fixes that by bumping the @tanstack/react-virtual library and using the enabled value and disable it when no options are given.

Fixes: #3353

Copy link

vercel bot commented Jul 2, 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 2, 2024 10:13pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2024 10:13pm

@RobinMalfait RobinMalfait changed the title Fix crash in Combobox component when in virtual mode without available options Fix crash in Combobox component when in virtual mode when options are empty Jul 2, 2024
@thecrypticace
Copy link
Contributor

I wasn't able to repro this originally but based on the fix in tanstack it was timing related so I think this is fine to merge 👍

@RobinMalfait
Copy link
Member Author

I could reproduce it locally a few times, but not consistently. However when I switch to the fixed branch (this one) I couldn't reproduce it anymore. When I switch back and try a few times I could reproduce it again.

@JCMais
Copy link

JCMais commented Jul 5, 2024

thank you so much @RobinMalfait!

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