Skip to content

Commit

Permalink
fix: session tree priority for component retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
mmikita95 committed Feb 22, 2024
1 parent 1310af2 commit 278a4c6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/streamsync/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand All @@ -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 = {
Expand Down

0 comments on commit 278a4c6

Please sign in to comment.