Skip to main content

Hotwire

Small helpers for working with Hotwire Turbo streams.

Response.turboStream​

Marks an existing response as a Turbo Stream by replacing its Content-Type with text/vnd.turbo-stream.html.

renderTemplate(request, "items/_row", model).turboStream()

turboStreamRefresh​

Returns a Turbo Stream response with a <turbo-stream action="refresh"> body, used to ask the client to perform a full page refresh.

fun turboStreamRefresh(): Response

turboStreamRedirect​

Returns a Turbo Stream response with a <turbo-stream action="redirect"> body, used to navigate the browser to another page. Turbo swaps the body of a stream response into the current page rather than following a redirect, so a handler answering a Turbo form submission sends this instead of a 303 when the next thing the user should see is another page.

turboStreamRedirect("/items/${item.id}")