Fix empty records bug and return empty string if state is not found

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-03-02 15:18:58 -03:00
commit 48ec2d2fa8
2 changed files with 3 additions and 1 deletions

View file

@ -25,6 +25,8 @@ class RecordsAsTextComponent(CustomComponent):
records: list[Record],
template: str = "Text: {text}\nData: {data}",
) -> Text:
if not records:
return ""
if isinstance(records, Record):
records = [records]

View file

@ -27,7 +27,7 @@ class GraphStateManager:
def get_state(self, key):
with self.lock:
return self.states.get(key, None)
return self.states.get(key, "")
def subscribe(self, key, observer: Callable):
with self.lock: