-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Description
Reproduction
TL:DR Here's the runnable example: https://codeberg.org/martinmckenna/react-router-flash-loader-test
and a video of that test application ^^ https://i.imgur.com/qlSmXqZ.mp4
I'm copying over this issue from Remix: remix-run/remix#7936, which I created under a bit of a misnomer.
This issue is with most SSR frameworks. Here's a couple other similar issues in other SSR framework repos:
sveltejs/kit#10700
vercel/next.js#57243
nuxt/nuxt#6101
The issue here is that when backswiping or clicking the back button on mobile, the old content flashes before the loader gets a chance to re-run and load the "previous" but really "new" content.
This PR in react.dev was proposed as a solution, but does not solve the problem:
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, both Remix and now React Router have this issue:
- 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
System Info
System:
OS: macOS 15.6
CPU: (14) arm64 Apple M3 Max
Memory: 441.38 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.19.4 - ~/.nvm/versions/node/v20.19.4/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.8.2 - ~/.nvm/versions/node/v20.19.4/bin/npm
Browsers:
Brave Browser: 139.1.81.131
Chrome: 139.0.7258.67
Safari: 18.6
npmPackages:
@react-router/dev: 7.7.0-pre.0 => 7.7.0-pre.0
@react-router/fs-routes: 7.7.0-pre.0 => 7.7.0-pre.0
@react-router/node: 7.7.0-pre.0 => 7.7.0-pre.0
@react-router/serve: 7.7.0-pre.0 => 7.7.0-pre.0
react-router: 7.7.0-pre.0 => 7.7.0-pre.0
vite: 7.0.4 => 7.0.4
Used Package Manager
yarn
Expected Behavior
When I click browser back button / backswipe, the old content doesn't flash
Actual Behavior
When you go to a page, then backswipe or click back, the previous page flashes before showing the new page