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
<!-- This does not work -->
<Toggle as |toggle|>
(toggle.snapshot.matches 'inactive')
</Toggle>
But this does not work with:
Uncaught TypeError: Cannot read properties of undefined (reading 'value')
And respective this(?) is there set to undefined:
(screenshot tests step1, but it's supposed to be inactive in the example above)
I came to this conclusion from an ability to access context on snapshot which works for me:
<Toggle as |toggle|>
{{toggle.snapshot.context.isActive}}
</Toggle>
I do not necessarily care about how do I call state.matches as there is a way, but I wanted to access state.can and possibly other functions, but it does not work for me.
I do not necessarily care about how do I call state.matches as there is a way, but I wanted to access state.can and possibly other functions, but it does not work for me
I ran into this same problem trying to use tags. It seems like you should be able to do something like this:
<Toggle as |toggle|>
{{if (toggle.snapshot.hasTag"on") "ON""not ON"}}
</Toggle>
But this doesn't seem to work for me. I worked around it by creating a helper function and doing it in JS:
<Toggle as |toggle|>
{{if (cantoggle"TOGGLE") "can toggle""cannot toggle"}}
</Toggle>
So it works, but these (and a couple other little things) are just enough friction to have me going back to using xstate directly instead of the component.
Activity
NullVoxPopuli commentedon Dec 22, 2024
aye, that's a bug with glimmer-vm, which (when fixed) will also unlock: emberjs/rfcs#1045
NullVoxPopuli commentedon Dec 22, 2024
tracking issue: https://github.com/glimmerjs/glimmer-vm-issues/issues/3
tcjr commentedon Apr 8, 2025
I ran into this same problem trying to use tags. It seems like you should be able to do something like this:
But this doesn't seem to work for me. I worked around it by creating a helper function and doing it in JS:
I tried
can, and it will work as well:So it works, but these (and a couple other little things) are just enough friction to have me going back to using xstate directly instead of the component.
NullVoxPopuli commentedon Apr 8, 2025
yea, sorry I haven't fixed the VM yet :(
waiting on some syntax changes in glimmerjs/glimmer-vm#1690