reflex icon indicating copy to clipboard operation
reflex copied to clipboard

pc.foreach doesn't handle correctly the State.slug var from catchall argument

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

Describe the bug When using a catchall route "path/[...slug]", the slug ComputedVar is correctly created, but it can't be passed to the pc.foreach component, because it is detected as a wrong type.

To Reproduce Steps to reproduce the behavior:

def catchall_index():
    return pc.foreach(State.slug, lambda arg: pc.text(arg))

app.add_page(catchall_index, path="path/[...slug]")
app.compile()

Expected behavior foreach should iterate correctly on the State.slug method

Screenshots The traceback that occurs: image

** Specifics (please complete the following information):**

  • Python Version: 3.10
  • Pynecone Version: main branch

Additional infos : The problem was previously discussed on the discord, in the thread : "Dynamic Routes"

Lendemor avatar Jan 14 '23 17:01 Lendemor