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

[Listbox] Listbox throws an error when using multi-select select without providing a value #2057

Closed
nwesthoff opened this issue Dec 2, 2022 · 2 comments · Fixed by #2058
Closed
Assignees

Comments

@nwesthoff
Copy link

nwesthoff commented Dec 2, 2022

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v1.7.4

What browser are you using?

Chrome & Safari

Reproduction URL

https://codesandbox.io/s/musing-cherry-y86t8u

Image from Gyazo

Describe your issue

When using Listbox with multiple prop, without providing a value (eg. when using it in uncontrolled manner), it throws after clicking the trigger/button:

Cannot read properties of undefined (reading 'some')
@RobinMalfait RobinMalfait self-assigned this Dec 2, 2022
@RobinMalfait
Copy link
Collaborator

RobinMalfait commented Dec 2, 2022

Hey! Thank you for your bug report!
Much appreciated! 🙏

We will make sure that it doesn't crash, however in multiple mode, you should always provide an array. If nothing is selected an empty array should be used.

Edit: Except in uncontrolled mode 🤔

@RobinMalfait
Copy link
Collaborator

This should be fixed by #2058, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

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