Răsfoiți Sursa

Fix raw list not working in foreach (#547)

Thomas Brandého 2 ani în urmă
părinte
comite
d0b47e1c23
1 a modificat fișierele cu 1 adăugiri și 0 ștergeri
  1. 1 0
      pynecone/components/layout/foreach.py

+ 1 - 0
pynecone/components/layout/foreach.py

@@ -36,6 +36,7 @@ class Foreach(Component):
             type_ = iterable.type_.__args__[0]
             type_ = iterable.type_.__args__[0]
         except Exception:
         except Exception:
             type_ = Any
             type_ = Any
+        iterable = Var.create(iterable)  # type: ignore
         if iterable.type_ == Any:
         if iterable.type_ == Any:
             raise TypeError(
             raise TypeError(
                 f"Could not foreach over var of type Any. (If you are trying to foreach over a state var, add a type annotation to the var.)"
                 f"Could not foreach over var of type Any. (If you are trying to foreach over a state var, add a type annotation to the var.)"