-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
What version of Remix are you using?
2.0.1
Are all your remix dependencies & dev-dependencies using the same version?
- Yes
Steps to Reproduce
I was observing my own site and a few sites in the Who's using remix in production discussion and it seems like out-of-the-box, Remix has this issue with the back button on mobile browsers where the back button doesn't really perform like you'd expect it to. It seems like by default, the page's loader is always re-run and you end up with this really janky experience:
- Navigate to new page
- Swipe to go back (or hit back button)
- See flash of the latest page you were on, then the page you expect to see appears
Here's like 4 different examples I found pretty easily just by browsing through that discussion:
video of https://datagunung.com
video of https://hub.findkit.com
video of https://basementcommunity.com
video of https://ajourney.io
Now, from what I can tell, HTTP Cache control headers don't really solve this problem. I tried implementing them on both the document and each loader individually, and it seems like this issue still happens. I'm not sure if this is just a side-effect of using client-side hydration after the first render, or perhaps a side-effect of having markup that is generated at the time the page is requested, but I feel like getting a cached page when hitting the back button should be behavior default to Remix without the developer having to figure this out.
Expected Behavior
Page flashes old content before showing right content when hitting back button on mobile browsers
Actual Behavior
Page loads cached page with no flashing on mobile browsers