Open
Description
Right now, you cannot directly use the live_action
helper to render live attributes because it returns a string. This means the following will not work:
<twig:Button type="button" {{ live_action("foo", { bar: "baz" }) }}>
Click me!
</twig:Button>
On the other hand, some helpers like stimulus_controller
and stimulus_action
work because they return an iterable that can be used with the Twig spread operator ....
.
I don't if why this returns a string instead of the StimulusAttributes
instance? What I'm missing?
This would be a great DX addition 👍
I changed LiveComponentRuntime
to return the StimulusAttributes
instance and the following will work without any problem:
<twig:Button
type="button"
content="Click me!"
{{ ...live_action("foo", { bar: "baz" }) }}
/>
<button type="button" {{ live_action("foo", { bar: "baz" }) }}>
Click me!
</div>