I saw somewhere that someone was putting a tubro_stream inside a turbo_frame response for a standard http GET request. I don’t think it was a form submission, just a GET.
Is this valid? The docs make it sound like turbo-stream are only for broadcasting and form submissions, not standard turbo_frame requests.
It’s legit because even the server-broadcasted
Both end up having a
So it’s legit, and sometimes it allows you to package both the updated HTML inside the turbo_frame itself and updating a different part of the page (e.g. adding a flash message somewhere else on the page) in the same response.
Interesting. So that makes me wonder why we respond to form submission differently (in a Rails application) then other requests.
For example, for a form submission we do
render turbo_stream: render turbo_stream: turbo_stream.replace(...)
But we simply render a template for turbo_frame requests.
My understanding is that these methods are not interchangeable, but your answer makes me wonder why not, given they are essentially the same in the end result.