From 278a4c634be8855c8beb94010df5c11d2075b2d0 Mon Sep 17 00:00:00 2001 From: mmikita95 Date: Thu, 22 Feb 2024 15:59:10 +0300 Subject: [PATCH] fix: session tree priority for component retrieval --- src/streamsync/core.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/streamsync/core.py b/src/streamsync/core.py index 3222c40fa..8e1bd1958 100644 --- a/src/streamsync/core.py +++ b/src/streamsync/core.py @@ -571,7 +571,7 @@ def to_dict(self) -> Dict: for id, component in self.components.items(): active_components[id] = component.to_dict() return active_components - + class SessionComponentTree(ComponentTree): @@ -580,10 +580,14 @@ def __init__(self, base_component_tree: ComponentTree): self.base_component_tree = base_component_tree def get_component(self, component_id: str) -> Optional[Component]: - base_component = self.base_component_tree.get_component(component_id) - if base_component: - return base_component - return self.components.get(component_id) + session_component = self.components.get(component_id, False) + + if not session_component: + if session_component is not None: + # Component is removed if set to None + return self.base_component_tree.get_component(component_id) + + return session_component def to_dict(self) -> Dict: active_components = {