Skip to content

Commit

Permalink
unpack tuple in itertag
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor committed Feb 6, 2025
1 parent 460ad89 commit a35c1b7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions reflex/components/tags/iter_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,14 @@ def render_component(self) -> Component:
raise ValueError("The render function must take 2 arguments.")
component = self.render_fn(arg, index)

# Nested foreach components, cond and tuples must be wrapped in fragments.
if isinstance(component, (Foreach, Cond, tuple)):
# Nested foreach components, cond must be wrapped in fragments.
if isinstance(component, (Foreach, Cond)):
component = Fragment.create(component)

# If the component is a tuple, unpack and wrap it in a fragment.
if isinstance(component, tuple):
component = Fragment.create(*component)

# Set the component key.
if component.key is None:
component.key = index
Expand Down

0 comments on commit a35c1b7

Please sign in to comment.