Override _remove_option to update the selected values

The developer could remove an option that is selected, so we need to catch
that this has happened and update the collection of selected values.
This commit is contained in:
Dave Pearson
2023-05-22 15:25:11 +01:00
parent 189181ba33
commit 68250e6ce3

View File

@@ -410,3 +410,7 @@ class SelectionList(Generic[SelectionType], OptionList):
def get_option(self, option_id: str) -> Selection[SelectionType]:
return cast("Selection[SelectionType]", super().get_option(option_id))
def _remove_option(self, index: int) -> None:
self._deselect(self.get_option_at_index(index).value)
return super()._remove_option(index)