New Discussion

Notifications

Youโ€™re not receiving notifications from this thread.

Auto-submitting Forms & Custom Turbo Stream Actions Discussion

14
General

Awsome work Chris. Thanks!

Glad you liked it Ahmed!

If you would apply this feature on several elements on the same page or multiple pages what is the best approach to do so?

The only way I see it now is duplicate code for every element. Other solutions?

Great episode. I think the best solution to remove an element would be to use a stimulus controller. And this way, it can be re-used easily and we don't have to keep writing the turbo_stream_action_tag. So something as simple as: <span id="saved" data-controller="remove" data-remove-timeout-value="5000">Saved</span> would do it and can be re-used.

Yep! I think a Stimulus controller for remove probably makes the most sense, however this was a great example to show off a small custom Turbo Stream.

It was. Thank you for this ๐Ÿ‘

Excellent episode and would really like to see more use cases for custom turbo stream actions. Opens up a world of opportunities!

They sure do and we will absolutely cover more ideas for them. Next episode is going to walk through using them to implement browser notifications. ๐Ÿ‘

Ooooh, VERY interested in that one.

Oh, yes please!

Love this, Chris: thank you!

Glad you're enjoying it. We'll keep doing more Hotwire stuff!

Did you remove the flash message behind the scenes or is it because you added the 'turbo_stream' action that it longer displays the "ticket is saved" message?

A flash message is set for the next full HTTP request. A turbo stream response is only a partial update to the existing page, so you would need to add a turbo stream to inject a flash message if you wanted to keep that.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 88,834+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.