You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Did my best with the title. Can't describe this very well, please see the reproduction as I almost died getting it.
In short, this code...
{#ifs.drawer}
{s.drawer.toString()}
{/if}
...crashes with s.drawer is undefined. The contents of the if are evaluated even when the if is false, but only when s.drawer is used as the argument of a transition (transition:whatever={s.drawer}).
<script>
consts=$state({})functionslide() {return { duration:150 } }functionopen() {s.drawer= { id:123 } }functionclose() {deletes.drawer }
</script>
Hit Open, then Close. It crashes and the drawer remains open but the Close
button cannot be interacted with anymore (see console).
<br><br>
{#ifs.drawer}
{@constid=s.drawer.id}
{#ifid}
Hi, I'm the drawer.
<!-- Remove the "={id}" and the error goes away -->
<buttontransition:slide|globalonclick={close}>Close</button>
{/if}
{/if}
<buttononclick={open}>Open</button>
Regression
This is also a regression. The same bug happens in legacy mode, but the code works in v4.
The text was updated successfully, but these errors were encountered:
rChaoz
changed the title
{#if a.deep != null} executes even when a.deep is null if it's used as the parameter of a transition{#if a.deep != null} runs when a.deep is null if used as a transition parameter
Mar 27, 2025
Describe the bug
Did my best with the title. Can't describe this very well, please see the reproduction as I almost died getting it.
In short, this code...
...crashes with
s.drawer is undefined
. The contents of theif
are evaluated even when theif
is false, but only whens.drawer
is used as the argument of a transition (transition:whatever={s.drawer}
).Reproduction
REPL
Regression
This is also a regression. The same bug happens in legacy mode, but the code works in v4.
v5 REPL | v4 REPL
Severity
annoyance
The text was updated successfully, but these errors were encountered: