event fixes

This commit is contained in:
John Lancaster
2026-02-22 18:25:26 -06:00
parent 07bdbe0b46
commit 0e58dc7a86
2 changed files with 13 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ class HookedMapping(HookedContainer[T], MutableMapping[T, MutableNesting[T]]):
def insert(self, key: T, value: MutableNesting[T]) -> None:
self._data[key] = value
if self.hook:
self.hook(e.AddItemEvent(value, path=self.new_path(key)))
self.hook(e.AddItemEvent(self.new_path(key), value))
# HookedContainer methods
@@ -58,10 +58,10 @@ class HookedMapping(HookedContainer[T], MutableMapping[T, MutableNesting[T]]):
else:
self._data[key] = value
if self.hook:
self.hook(e.SetItemEvent(value, path=self.new_path(key)))
self.hook(e.SetItemEvent(self.new_path(key), value))
def __delitem__(self, key: T) -> None:
item = self._data[key]
del self._data[key]
if self.hook:
self.hook(e.RemoveItemEvent(item, path=self.new_path(key)))
self.hook(e.RemoveItemEvent(self.new_path(key), item))