A flexible and robust Python library for creating, managing, and interacting with data services, with built-in support for web and RPC servers, and customizable features for diverse use cases.
Dynamically adding a class instance containing a property to a list used to emit change notifications of this property although the list change wasn't emitted yet. So this code:
2024-02-20 12:23:30.065 | DEBUG | pydase.data_service.data_service_observer:on_change:43 - 'channels[0].name' changed to 'Hello'
2024-02-20 12:23:30.065 | DEBUG | pydase.data_service.data_service_observer:on_change:43 - 'channels' changed to '[<__main__.PropertyClass object at 0x7f3c2db6f350>]'
2024-02-20 12:23:30.065 | DEBUG | pydase.data_service.data_service_observer:on_change:43 - 'channels[0].name' changed to 'Hello'
2024-02-20 12:23:30.066 | DEBUG | pydase.data_service.data_service_observer:on_change:43 - 'channels[0].name' changed to 'Hello'
2024-02-20 12:23:30.066 | DEBUG | pydase.data_service.data_service_observer:on_change:43 - 'channels[0].name' changed to 'Hoooo'
This is caused by the serialization of the object when it is compared to the cached_value. As the object has been added to the _ObservableList, it could already emit such a notification even though the 'channels' changed to '[<__main__.PropertyClass object at 0x7f3c2db6f350>]' notification hasn't yet been emitted.
This MR fixes this by
only emitting change notifications is the containing object is not being changed itself
telling the observer when starting to append an element to a list
removing the path of a changed attribute only after running the on_change method
Dynamically adding a class instance containing a property to a list used to emit change notifications of this property although the list change wasn't emitted yet. So this code:
would emit:
This is caused by the serialization of the object when it is compared to the
cached_value
. As the object has been added to the_ObservableList
, it could already emit such a notification even though the'channels' changed to '[<__main__.PropertyClass object at 0x7f3c2db6f350>]'
notification hasn't yet been emitted.This MR fixes this by
on_change
method