Manuel Meurer
Manuel Meurer

Reputation: 3478

Rails/Hotwire - don't cache Turbo frames on restoration visits

I have a page that contains a Turbo frame which loads some content from another URL using the src param.

Now when I click a link to navigate away from that page and then press "Back" in my browser, it's what Turbo calls a "restoration" visit, on which it displays the cached page without loading it again from the server.

This is exactly what I want EXCEPT for the Turbo frame - it should never be cached and always be reloaded from the URL it has as its src param.

How can this be done?

Upvotes: 1

Views: 734

Answers (1)

Sebastian Scholl
Sebastian Scholl

Reputation: 1095

The turbo-data-permanent attribute may be what you're looking for:

https://turbo.hotwired.dev/handbook/building#persisting-elements-across-page-loads

Upvotes: 0

Related Questions