After replacing turbolinks with the turbo-rails gem in my app, I’m seeing strange behavior from form submissions. The controller processes the update action and sends redirects to the index page, but the page never updates. In the browser devtools I’m seeing 2 XHR requests: a POST to update that comes back as 302, and then a GET to the index page that comes back 200. Both are sent as content type “text/vnd.turbo-stream.html”. The index response includes the HTML fragment from the action template- the layout is not included.
I have another app using turbo where form submits work fine, but those form submits are sent as content type text/html. My best explanation for what’s going on is that rails is refusing to render the layout on
text/vnd.turbo-stream.html requests and this somehow breaks Turbo’s ability to update the page.
There are no turbo-frames or anything going on- just plain rails scaffold workflow. Versions are Rails 22.214.171.124, turbo-rails 0.5.9, @hotwired/turbo@^7.0.0-beta.4.
How does Turbo determine whether to send form submits as text/html or text/vnd.turbo-stream.html? Am I correct that receiving a response without a layout would prevent Turbo from updating the page? And if so, how can I force rails to include the layout?