From f0b72b5c3b6fd83fce6e00ffc14c1403f5296fd5 Mon Sep 17 00:00:00 2001 From: Gabriel Selzer Date: Thu, 23 Apr 2026 08:54:19 -0500 Subject: [PATCH] Ignore child events in adaptors Most of the time, the user doesn't want to know about child changes --- src/scenex/adaptors/_base.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scenex/adaptors/_base.py b/src/scenex/adaptors/_base.py index 49b41993..edfdf2b8 100644 --- a/src/scenex/adaptors/_base.py +++ b/src/scenex/adaptors/_base.py @@ -51,14 +51,25 @@ def handle_event(self, info: EmissionInfo) -> None: # Parent change events are handled by the parent adaptor. return + arg = info.args[0] try: name = self.SETTER_METHOD.format(name=signal_name) setter = getattr(self, name) except AttributeError as e: + if len(info.path) > 1: + # A length 2+ path implies a child event bubbling up to a parent that + # doesn't have a handler for it. Let's just ignore it. + nested_name = "".join(f".{step.attr}" for step in info.path)[1:] + logger.debug( + "EVENT: %r ignored %s=%r (bubbling up, no handler)", + type(self), + nested_name, + arg, + ) + return logger.exception(e) return - arg = info.args[0] logger.debug("EVENT: %r -> %s=%r ", type(self), signal_name, arg) try: