-
Notifications
You must be signed in to change notification settings - Fork 933
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(useMultipleSelect): removeSelectedItem adding duplicate items to selected items #1353
Conversation
Hello! Not sure but i think this PR could fix this also: Will try it once is good. |
I don't think it will, downshift relies on the items being reference equal so you probably need to fix how you're handling/re-creating your items |
so we have to drop all the good immutability practices? Why not being dependent on the content of the array instead of it's reference? Replacing/deleting object properties may not be the best option... Also the example 5 is broken even just by adding some initial choices, no need to manipulate the object with .map() to cause the error of multiplying selected items. And also it only happens with the inside of the popper, removing badges works as expected, so maybe is more an issue with the example than downshift itself? 🤔 I personally was unable to understand where it comes from |
Hi! Will take a look at this and will merge if it's good to go. Thank you! |
Hello @silviuaavram would be lovely to get some news about this, I think this is creating some weird bugs like this one: #1355 |
@lveillard this will prevent you from getting duplicated values but won't fix your issue, you need to provide an item referentially equal to one of the provided items |
Finally fixed the CI pipeline. Let's see what this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great changes and tests, congrats!
I think we should rebase this with latest master, since it has been a while, do that small change and merge it.
Thank you again for your patience @drewbrend !
@all-contributors please add @drewbrend for code |
I've put up a pull request to add @drewbrend! 🎉 |
🎉 This PR is included in version 6.1.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
fixes #1316
What:
Fixing the handling of undefined/null being provided to
useMultipleSelection
'sremoveSelectedItem
function.Why:
Currently when undefined/null is provided one of the items is duplicated in
selectedItems
How:
Only modifying the
selectedItems
andactiveIndex
ifselectedItemIndex
is greater than or equal to zeroChecklist: