pateketrueke / yrv

Your routing vibes! (for Svelte)
https://svelte.dev/repl/0f07c6134b16432591a9a3a0095a80de
161 stars 9 forks source link

Conditionals are broken on Routes #85

Closed r3ndd closed 2 years ago

r3ndd commented 2 years ago

The following does not stop a Route from being rendered:

<Route condition={() => false}>
</Route>
pateketrueke commented 2 years ago

Hi, can you expand more? If you have a REPL repro it would help to address this bug, thank you!

Edit: oh, nevermind, I have a repro: https://svelte.dev/repl/4c79324242974525bc63dc73241f3019?version=3

Definitely a bug, let me investigate.

pateketrueke commented 2 years ago

I was looking at the code and I think is a documentation issue, the condition prop on Route works only if redirect is used too, that would condition if the redirect happens or not: when condition resolves to anything truthy, then the redirect is omitted and the route gets rendered, otherwise you are redirected.

r3ndd commented 2 years ago

Okay, if that's intended behavior then I'll close this issue.