Replacing Turbolinks with Turbo - not as easy as it could be?


There’s a lot of old and out of date information out there about replacing Turbolinks with Turbo and I am struggling to make it as easy as it should be.

A turbolinks app submits forms and responds to redirects as it always has. Drop in Turbo instead - no frames in sight - and form submissions no longer work as before.

Form submissions response is silently discarded and when redirecting on success - Turbo follows the 302 response but does nothing with the subsequent body because its not a turbo frame.

I know that you can stop this by adding data: {turbo: false} to the form but this requires updating every form in an application and prevents the content only interception resulting in full assets fetch.

Am I missing something or is this the expected solution to upgrading to Turbo ? Should this behaviour only occur if the form is inside a turbo-frame ?

I found one of the causes of my difficulties -

The application I am upgrading uses haml views and none of them have the format in the file name,
i.e. they are all named like this -


This results in non-turbostream renders not being able to determine the format and serving the content as -

Content-Type: text/vnd.turbo-stream.html; charset=utf-8

Which Turbo isn’t expecting for a non-turbo wrapped request so it just does nothing with it.

Naming the views -


and the content is served with -

Content-Type: text/html; charset=utf-8
and everything works as advertised.