Skip to content

Page Reload Behavior with Data Prefetching Using Tanstack Router #1162

@RomSribn

Description

@RomSribn

Describe the bug

We have encountered an issue with data prefetching in our application utilizing @tanstack/react-query version 5.8.7 and @tanstack/react-router version ^1.0.5. The core of the problem lies in the application’s behavior when employing the defaultPreload: 'intent' flag to enable link hover prefetching. Specifically, upon prefetching data on hover, the entire page appears to reload, affecting even those components that are unrelated to the prefetching process, essentially reverting them to their initial state.

Your Example Website or App

Steps to Reproduce the Bug or Issue

  1. Enable data prefetching with defaultPreload: 'intent' in the @tanstack/react-router settings.
  2. Hover over a link that triggers data prefetching.
  3. Observe as the entire page resets to its initial state, including components unrelated to the preloaded route.

Expected behavior

Data prefetching on hover should only refresh the data and components directly associated with the preloaded route without causing a full page reload or affecting unrelated components.

Screenshots or Videos

example.mov

Platform

  • @tanstack/react-query version: 5.8.7
  • @tanstack/react-router version: ^1.0.5
  • Browser: Chrome (latest stable version)
  • Operating System: macOS

Additional context

We have attached a video demonstrating the described behavior for a clearer understanding of the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions