-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[Autocomplete] Fix Multiple tag delete action #18153
[Autocomplete] Fix Multiple tag delete action #18153
Conversation
Details of bundle changes.Comparing: 262c8cf...5e60be1
|
@tkanzakic Thank you for starting an effort on this issue. Do you think that you can update the rest of the codebase to account for this new approach? We will need to update the demos, the typescript definitions, the docs and add a new test to prevent regressions :). |
Definitely, let me take a look, thanks for the guidance |
@tkanzakic Did you had the time to look at it? :) |
@oliviertassinari I started to look deeper on this but I’m moving slow as I’m getting used to the source code. If this’s urgent feel free to do it yourself. I can look at a different ticket. |
@tkanzakic Ok, no problem. Take your time to dive into the codebase :). I think that it would be great to have it solved in the next release, likely before the end of the week. |
@oliviertassinari I'm having busy days at work this week, I will try to get back to this today |
@tkanzakic I'm doing a follow-up, I will rebase and push a new commit. I think that it would be great to release it this weekend, Saturday, or Sunday. Thank you for the interest, if you could have a look at the diff, it would be awesome. |
fix a bug where the remove item always remove the first item in the Autocomplete instead of the selected one
a926888
to
5e60be1
Compare
multiple | ||
/>, | ||
); | ||
fireEvent.click(container.querySelectorAll('svg[data-mui-test="CancelIcon"]')[1]); |
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.
@eps1lon any better idea for this selector?
@oliviertassinari thanks for taking the ownership over this task, I am having a long week. Hope to be able to contribute in other tasks. |
@tkanzakic Good, this problem was quite important 😁. |
Hi, Excuse me ). When this fix will be in npm repository? When can I use correct version? |
This comment has been minimized.
This comment has been minimized.
@@ -607,8 +607,7 @@ export default function useAutocomplete(props) { | |||
selectNewValue(event, filteredOptions[highlightedIndexRef.current]); | |||
}; | |||
|
|||
const handleTagDelete = event => { | |||
const index = Number(event.currentTarget.getAttribute('data-tag-index')); | |||
const handleTagDelete = index => event => { | |||
const newValue = [...value]; | |||
newValue.splice(index, 1); |
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.
@oliviertassinari Just wanted to know, why are we using splice here. For example i am having 3 values selected [1,2,3] and trying to delete first element in the array, in this case we will be passing index as 0 to renderTagProps. So if you splice array with 0,1 (newValue.splice(0,1)) will return first element in the array [1].
We are facing issue like if we try to delete any element in our selected value list, it always removes last element instead of actual element which we try to delete.
Fix #18081
Breaking change