Help with Turbo caching and page navigation

@alimi
Fri, 03 Oct 2025 20:25:17 +0000

I’m using Turbo in a pretty vanilla Rails 8 app. We have a few pages that render tables that users can filter. We’ve set things up so the filters live in a form outside the table, and the table is rendered inside a Turbo Frame. The form targets the Turbo Frame so the table refreshes without a whole page load (the form is submitted via a GET request). This lets us update the content while maintaining the filters the user has selected. The markup is roughly




<turbo-frame id="table">

</turbo-frame>

This pattern has been working really well, but it gets wonky with Turbo caching and page navigation. For example imagine that the form has a text field for a search term. You try 3 searches and the Turbo Frame updates each time. Now you click the back button and see search 2’s results, BUT the text field still has search 3’s search term.

When I inspect the network traffic, there are no requests for going back to search 2 because Turbo pulled the page from its cache. But it looks like Turbo is only loading the cached content into the Turbo Frame. Why?