reflex
reflex copied to clipboard
[BUG] wrong typing in the BaseVar that result from a pc.foreach()
Describe the bug
When using pc.foreach() with a list of str as iterable input, the BaseVar that you obtain for rendering does not possess the correct type
To Reproduce Steps to reproduce the behavior:
def minimal_test():
return pc.vstack(
pc.foreach(
["aa", "bb"],
lambda value: pc.markdown(value)
)
)
Expected behavior Should display correctly the elements from the list, instead crash during compilation
Additional context
In the value variable, type_ should be str:
ic| value: BaseVar(name='_', type_=typing.Any, state='', is_local=True, is_string=False)
I used pc.markdown for the example as it currently only accept str rather than BaseVar (see #293 ) but the issue lie in the pc.foreach output.
Specifics:
- Python Version: 3.10
- Pynecone Version: 0.1.13
- OS: Ubuntu 22.04