Skip to content

Commit db327b7

Browse files
committed
delete model event handlers in when unmounting
1 parent f902316 commit db327b7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/idom/core/layout.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,9 @@ def _unmount_model_states(self, old_states: List[_ModelState]) -> None:
404404
while to_unmount:
405405
model_state = to_unmount.pop()
406406

407+
for target in model_state.targets_by_event.values():
408+
del self._event_handlers[target]
409+
407410
if hasattr(model_state, "life_cycle_state"):
408411
life_cycle_state = model_state.life_cycle_state
409412
del self._model_states_by_life_cycle_state_id[life_cycle_state.id]
@@ -583,7 +586,7 @@ def __init__(
583586
self.targets_by_event = targets_by_event
584587
"""The element's event handler target strings indexed by their event name"""
585588

586-
# === Conditionally Evailable Attributes ===
589+
# === Conditionally Available Attributes ===
587590
# It's easier to conditionally assign than to force a null check on every usage
588591

589592
if parent is not None:

0 commit comments

Comments
 (0)