Build the selection list back in __init__ again

Now that I'm no longer having to dodge issues with getting component classes
before the DOM has spun up, I can go back to the simpler method of setting
up the selections.

This also means I can drop Mount handling.
This commit is contained in:
Dave Pearson
2023-05-18 16:20:32 +01:00
parent 12416d81d1
commit bc126ce036

View File

@@ -116,20 +116,13 @@ class SelectionList(Generic[SelectionType], OptionList):
disabled: Whether the selection list is disabled or not.
"""
super().__init__(
*[self._make_selection(selection) for selection in selections],
name=name,
id=id,
classes=classes,
disabled=disabled,
)
self._selected: dict[SelectionType, None] = {}
self._selections = selections
def _on_mount(self):
self.add_options(
[self._make_selection(selection) for selection in self._selections]
)
if self.option_count:
self.highlighted = 0
def _make_selection(
self,