reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[BUG] wrong typing in the BaseVar that result from a pc.foreach()

Open Lendemor opened this issue 3 years ago β€’ 0 comments

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

Lendemor avatar Jan 21 '23 18:01 Lendemor