-
Notifications
You must be signed in to change notification settings - Fork 478
Prefetch causes wrong pages to be rendered #1479
Description
If a user clicks on a link, and while that page is loading clicks on another link and that page happens to load faster than the previous one, the former page will still be loaded in after the latter one has already loaded. You can reproduce it in this example: https://www.inspiredminds.at/turbo.php. "Page 1" has an artificial loading time of 4000ms while "Page 2" only has a loading time of 500ms. To reproduce do the following:
- Go to https://www.inspiredminds.at/turbo.php
- Hover & click on Page 1.
- Then immediately click on Page 2.
- It will show the content of "Page 2".
- Then it will show the content of "Page 1" - but the URL also has changed to
/page1.php. - Click on Home.
- Hover & click on Page 1.
- Then immediately click on Page 2.
- It will show the content of "Page 2".
- Then it will show the content of "Page 1" - but the URL stays at
/page2.php.
2025-12-13.15-03-52.mp4
This does not happen if you add
<meta name="turbo-prefetch" content="false">because then when clicking on Page 2, the request to Page 1 is immediately cancelled by Turbo and thus can never be rendered. But with prefetch enabled, no cancellation ever takes place and pages seem to be simply rendered in the order they are finished instead of the order they were requested.