skip to content

Hotwire

Hotwire builds interactive pages by sending HTML over the wire: Turbo swaps pages, frames and streamed fragments, and Stimulus adds small controllers. Interviewers weigh it against a full SPA.

on this pageshow

explore

questions

page 2 of 2

A link-heavy news site moves to Turbo 8 and readers get signed out just by hovering over its 'Log out' link. Why, and how do you fix it?

level: seniorimportance: should knowfreq 40%

basics

~20 s

Turbo 8 prefetches same-origin GET links on hover, so a GET /logout link runs the sign-out before any click. Make sign-out a non-GET request (button_to with method: :delete), which Turbo never prefetches; data-turbo-prefetch="false" only masks it.

open as a page

A Rails 8.1 address book's contact frame shows 'Content missing' whenever a session expires mid-edit. Why does this happen, and how do you fix it?

level: seniorimportance: should knowfreq 32%

basics

~20 s

The frame's request is redirected to the login page, which has no frame with the expected id, so Turbo fires turbo:frame-missing and writes Content missing. Mark the login page turbo-visit-control reload, or handle turbo:frame-missing with a full visit.

open as a page

A turbo-rails broadcast renders a kitchen ticket partial that checks Current.user to show an edit button; why do the boards show the wrong button or fail, and how do you fix it?

level: seniorimportance: should knowfreq 38%

basics

~20 s

Broadcasts render the partial once, outside any request, through ApplicationController.render, and send the same HTML to every subscriber: in a *_later job Current.user is nil, and a synchronous broadcast renders the editor's view for everyone. Keep broadcast partials viewer-independent.

open as a page

With turbo_stream_from, what does the signed stream name protect against, and why is it not a full authorization check?

level: seniorimportance: should knowfreq 30%

basics

~20 s

The signature stops users from forging or editing a stream name to subscribe to someone else's updates; but it never expires and Turbo::StreamsChannel checks nothing else, so anyone who once received the page can keep listening.

open as a page

In Turbo 8, how do method="morph" on replace and update stream actions and refresh="morph" on a turbo-frame bring morphing beyond page refreshes?

level: middleimportance: nice to knowfreq 20%

basics

~20 s

Turbo has no morph stream action: replace and update accept method="morph" to morph the target instead of swapping it. A frame with src and refresh="morph" is reloaded and morphed during a page refresh or reload() instead of being replaced.

open as a page

In a Hotwire Native app, how do path configuration rules make a habit tracker's /habits/new open as a modal, and how are matching rules combined?

level: middleimportance: nice to knowfreq 24%

basics

~20 s

The path configuration is JSON with settings and rules; each rule pairs regex patterns with properties. Every rule whose pattern matches the path applies in order, later ones overriding earlier ones, so a "/new$" rule with "context": "modal" opens /habits/new as a modal.

open as a page

In Hotwire Native, how does a bridge component put a native Save button on a habit form, and what happens in app builds that lack the component?

level: seniorimportance: nice to knowfreq 18%

basics

~20 s

A web BridgeComponent (a Stimulus controller with static component = "form") messages a same-named native component, which shows a Save button and replies when tapped so the web callback submits the form. Builds without it keep the HTML button.

open as a page

When wrapping a habit tracker in Hotwire Native shells, how would you decide which screens stay web, which gain bridge components and which become fully native?

level: principalimportance: nice to knowfreq 20%

basics

~20 s

Start with every screen as web, add bridge components where a web screen needs native controls, and rebuild only screens whose interaction, device access or offline needs the web view cannot meet. Path configuration maps those URLs to native screens per build.

open as a page

showing 31–38 of 38