-
Notifications
You must be signed in to change notification settings - Fork 936
useCombobox: HighlightedIndex and Items are not in sync #1623
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
Comments
All you need to do is to update your own code in these areas; change this
to this
and also update the isItemDisabled function to this
|
I hope @Bluebberies comment solved it, @christinaheidt . Closing. |
@silviuaavram shouldn't the typings be fixed? -isItemDisabled?(item: Item, index: number): boolean
+isItemDisabled?(item: Item | undefined, index: number): boolean Line 342 in 59d3498
|
downshift
version: 9.0.7node
version: 20.9.0yarn
version: 4.4.0Relevant code or config
What you did:
What happened:

The highlightedIndex is always one step behind the item list. E.g. when searching for a disabled item the first time the list gets reduced to just that item but the highlighted index is still at value 0 instead of being -1. Furthermore when searching for a value that doesn't exist in the list the application will run into an exception with the second update:
Reproduction repository:
https://codesandbox.io/p/sandbox/musing-williams-jwq6vz?file=%2Fsrc%2Fhooks%2FuseCombobox%2Fbasic-usage.js&moduleview=-1
Problem description:
See what happened
Suggested solution:
The items and the index should update at the same time
The text was updated successfully, but these errors were encountered: