Skip to content

Prefetch causes wrong pages to be rendered #1479

@fritzmg

Description

@fritzmg

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:

  1. Go to https://www.inspiredminds.at/turbo.php
  2. Hover & click on Page 1.
  3. Then immediately click on Page 2.
  4. It will show the content of "Page 2".
  5. Then it will show the content of "Page 1" - but the URL also has changed to /page1.php.
  6. Click on Home.
  7. Hover & click on Page 1.
  8. Then immediately click on Page 2.
  9. It will show the content of "Page 2".
  10. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions