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

Combobox virtual feature randomly gives an error: Uncaught Error: Unexpected undefined at notUndefined at Virtualizer.getOffsetForIndex #3353

Closed
JCMais opened this issue Jul 1, 2024 · 1 comment · Fixed by #3356
Assignees

Comments

@JCMais
Copy link

JCMais commented Jul 1, 2024

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

v2.1.1

What browser are you using?

Chrome, but does not matter

Reproduction URL

https://codesandbox.io/p/devbox/still-leftpad-xr4zpk?file=%2Fsrc%2FCombobox.jsx&embed=1

Steps to reproduce:

  1. click the field
  2. clear the input (type "a")
  3. press enter
  4. error happens

Describe your issue
I am randomly getting the error: Error: Unexpected undefined when the list is empty.

image

I think one possible fix here is to bump the @tanstack/react-virtual package to the latest version and disable the virtualizer when the list is empty

This is related to this ticket TanStack/virtual#696 and the related link PR: TanStack/virtual#741

@RobinMalfait
Copy link
Member

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

You can already try it using:

  • npm install @headlessui/react@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
Development

Successfully merging a pull request may close this issue.

2 participants