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 pageshowhide
explore
- Turbo Drive Navigation6 questions
- Turbo Frames5 questions
- Turbo Streams & Broadcasts6 questions
- Morphing Page Refreshes5 questions
- Stimulus Controllers & Actions5 questions
- Values, Classes & Outlets6 questions
- Native Mobile Shells5 questions
questions
page 2 of 2A 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?
basics
~20 sTurbo 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.
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?
basics
~20 sThe 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.
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?
basics
~20 sBroadcasts 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.
With turbo_stream_from, what does the signed stream name protect against, and why is it not a full authorization check?
basics
~20 sThe 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.
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?
basics
~20 sTurbo 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.
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?
basics
~20 sThe 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.
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?
basics
~20 sA 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.
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?
basics
~20 sStart 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.
showing 31–38 of 38