Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turbo Drive back button caching behaviour #541

Open
drale2k opened this issue Dec 12, 2023 · 2 comments
Open

Turbo Drive back button caching behaviour #541

drale2k opened this issue Dec 12, 2023 · 2 comments

Comments

@drale2k
Copy link

drale2k commented Dec 12, 2023

i have read about how Turbo Drive handles caching from the docs and understand that when caching is enabled (by default), Turbo will load a cached version from the browser when the back button is clicked. However, this means you get obsolete content of the previous page you go back to and have to hard reload anyway to make sure you did not miss anything. Worst case users don't know to reload and will see an outdated page.

The only way around this issue seems to be to opt out of caching completely, using <meta name="turbo-cache-control" content="no-cache">.

When looking at Basecamp and HEY though, both apps perform a network request to fetch a fresh page when the back button was hit. They do that without using the no-cache directive and i would like to know how this is done or rather what the correct approach is to this issue.

@brunoprietog
Copy link
Contributor

HEY also has this problem. For example, take an unread mail in Paper Trail. Open it and then go back. It still shows up as unread because it doesn't refresh.

This is intentionally designed into Turbo for some reason unknown to me, although I would love for it not to be. Maybe I could open a PR to propose the change.

@drale2k
Copy link
Author

drale2k commented Dec 18, 2023

Then it seems to be on a screen by screen basis, likely decided based on screen importance. I would also like to see it gone or at least not be the the default behaviour and alternatively have a way to opt-in in case this was added for good reason (bandwidth preservation on mobile devices maybe).

I think going into 2024 we are at a point technologically where going back is not only safe to re-fetch data most of the time but also expected by the regular user. With the ability to opt out (reverse of turbo-cache-control) in case your users are from areas around the world where bandwidth is expensive or slow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants