Fix empty records bug and return empty string if state is not found
This commit is contained in:
parent
d4cad81302
commit
48ec2d2fa8
2 changed files with 3 additions and 1 deletions
|
|
@ -25,6 +25,8 @@ class RecordsAsTextComponent(CustomComponent):
|
||||||
records: list[Record],
|
records: list[Record],
|
||||||
template: str = "Text: {text}\nData: {data}",
|
template: str = "Text: {text}\nData: {data}",
|
||||||
) -> Text:
|
) -> Text:
|
||||||
|
if not records:
|
||||||
|
return ""
|
||||||
if isinstance(records, Record):
|
if isinstance(records, Record):
|
||||||
records = [records]
|
records = [records]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class GraphStateManager:
|
||||||
|
|
||||||
def get_state(self, key):
|
def get_state(self, key):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
return self.states.get(key, None)
|
return self.states.get(key, "")
|
||||||
|
|
||||||
def subscribe(self, key, observer: Callable):
|
def subscribe(self, key, observer: Callable):
|
||||||
with self.lock:
|
with self.lock:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue