table: allow rows to be a Var (#1374)

This commit is contained in:
Masen Furer 2023-07-19 18:01:44 -07:00 committed by GitHub
parent d1924bb4a6
commit 370e1fd04c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,7 +104,16 @@ class Tbody(ChakraComponent):
Component: _description_
"""
if len(children) == 0:
children = [Tr.create(cell_type="data", cells=row) for row in rows or []]
if isinstance(rows, Var):
children = [
Foreach.create(
rows, lambda row: Tr.create(cell_type="data", cells=row)
)
]
else:
children = [
Tr.create(cell_type="data", cells=row) for row in rows or []
]
return super().create(*children, **props)