fix: adds observable to an observable object accessed via a property

When an observable is stored returned by a property, this adds the
parent object as an observer to the observable returned by the property.
This commit is contained in:
Mose Müller 2025-03-28 08:55:06 +01:00
parent c36cebf17c
commit f2c0a94904

View File

@ -55,6 +55,10 @@ class Observable(ObservableObject):
value = super().__getattribute__(name) value = super().__getattribute__(name)
if is_property_attribute(self, name): if is_property_attribute(self, name):
# fixes https://github.com/tiqi-group/pydase/issues/187 and
# https://github.com/tiqi-group/pydase/issues/192
if isinstance(value, ObservableObject):
value.add_observer(self, name)
self._notify_changed(name, value) self._notify_changed(name, value)
return value return value