mirror of
https://github.com/Choices-js/Choices.git
synced 2026-03-14 22:55:46 +01:00
Fix removing a choice didn't work properly when it was part of a group
This commit is contained in:
parent
8c56acb44c
commit
6b776717f9
2 changed files with 4 additions and 0 deletions
|
|
@ -13,6 +13,7 @@
|
|||
* Fix regression of `UnhighlightItem` event not firing [#1173](https://github.com/Choices-js/Choices/issues/1173)
|
||||
* Fix `clearChoices()` would remove items, and clear the search flag.
|
||||
* Fixes for opt-group handling/rendering
|
||||
* Fix `removeChoice()` did not properly remove a choice which was part of a group
|
||||
|
||||
### Chore
|
||||
* Add e2e tests for "no choices" behavior to match v10
|
||||
|
|
|
|||
|
|
@ -22,6 +22,9 @@ export default function choices(s: StateType, action: ActionTypes, context?: Opt
|
|||
case ActionType.REMOVE_CHOICE: {
|
||||
action.choice.choiceEl = undefined;
|
||||
|
||||
if (action.choice.group) {
|
||||
action.choice.group.choices = action.choice.group.choices.filter((obj) => obj.id !== action.choice.id);
|
||||
}
|
||||
state = state.filter((obj) => obj.id !== action.choice.id);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue