Allow additional attributes on the turbo_stream_action_tag
helper
#373
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Turbo now supports Custom Stream Actions via hotwired/turbo#479. In order to be able to properly use Custom Stream Actions in your application you also need to have a new server-side helper to generate the corresponding
<turbo-stream>
element.Imagine a Custom Stream Action
console_log
which prints out a message via JavaScript'sconsole.log
. The action takes two arguments: the first one is the message itself and the second optional argument is the log-level.This Pull Requests allows to write a custom helper, like so:
This now allows you to call
console_log
onturbo_stream
throughout the application with:Which produces the following payload:
Previously this wasn't possible because the
turbo_stream_action_tag
method wouldn't take any additional arguments.