skip to content

Turbo Drive Navigation

Turbo Drive turns link clicks and form submits into fetch requests that swap the page body, with a snapshot cache, hover prefetch and a 303-or-4xx form rule. Interviewers probe what breaks.

on this pageshow

explore

questions

6

With Turbo Drive, why must a successful Rails form submission redirect with 303 See Other while a failed one renders with a 4xx status?

level: middleimportance: must knowfreq 72%

basics

~20 s

Turbo Drive treats a non-GET form as a visit that must end in a redirect, which it follows and renders. A 4xx or 5xx response is rendered in place, so a failed save re-renders with 422; a plain 200 render is refused.

open as a page

With Turbo Drive's page cache, why does a Rails page flash stale content on navigation, and how do turbo-cache-control and data-turbo-temporary help?

level: middleimportance: should knowfreq 35%

basics

~20 s

Turbo Drive caches the last pages visited and shows a cached copy as a preview while it fetches a fresh one, and restores from cache on Back. turbo-cache-control no-preview or no-cache opts a page out; data-turbo-temporary removes flashes first.

open as a page

After a Rails 8.1 deploy changes CSS or JavaScript, how does data-turbo-track="reload" make tabs already open under Turbo Drive load the new assets?

level: seniorimportance: should knowfreq 30%

basics

~20 s

Turbo Drive compares the head elements marked data-turbo-track="reload" on the current and the new page. If their markup differs, as digested asset URLs do after a deploy, Turbo abandons the swap and does a full page load.

open as a page

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