Skip to content

Navigation with <ClientRouter /> triggers duplicate server requests in Astro 5.17.1 #15441

@wfl8156w-eng12

Description

@wfl8156w-eng12

Astro Info

- Astro: 5.17.1
- @astrojs/react: 4.4.2
- @astrojs/node: 9.5.2
- Node: v22.14.0
- OS: Windows

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When navigating between pages in an Astro 5.17.1 project using the <ClientRouter /> component, the server receives two identical requests for the destination page. This "Double Loading" behavior occurs during client-side navigation and persists even when the prefetch feature is disabled.

In our investigation, we found that:

  1. Disabling prefetch: { defaultStrategy: 'hover' } or removing data-astro-prefetch attributes did not resolve the issue.
  2. Commenting out <ClientRouter /> (falling back to standard MPA navigation) completely fixed the double request problem.
  3. The issue seems specific to how ClientRouter handles transitions or requests in certain environments (Windows, Node v22.14.0).

What's the expected result?

Steps to Reproduce

  1. Create an Astro 5.17.1 project.
  2. Enable <ClientRouter /> in a common layout (e.g., BaseLayout.astro).
  3. Run the project in development or production mode.
  4. Open the network tab or monitor server-side logs.
  5. Navigate from one page to another (e.g., / to /product/sticker).
  6. Observation: Two GET requests for the destination URL are logged by the server.

Link to Minimal Reproducible Example (Optional)

Pending creation of a minimal reproduction repo.

Environment Information

- Astro: 5.17.1
- @astrojs/react: 4.4.2
- @astrojs/node: 9.5.2
- Node: v22.14.0
- OS: Windows

Actual Result

Two requests are sent to the server for every client-side navigation.

Expected Result

Only one request should be sent to the server for a single navigation event.

Additional Context

Disabling ClientRouter solves the problem, but we lose the View Transition animations. We are currently using MPA mode as a workaround.
There are similar reports online about astro:page-load firing twice, which might be related to this server-side double loading issue.

Link to Minimal Reproducible Example

https://bolt.new/~/sb1-x8xdcaaj

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reproIssue needs a reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions