-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Description
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:
- Disabling
prefetch: { defaultStrategy: 'hover' }or removingdata-astro-prefetchattributes did not resolve the issue. - Commenting out
<ClientRouter />(falling back to standard MPA navigation) completely fixed the double request problem. - The issue seems specific to how
ClientRouterhandles transitions or requests in certain environments (Windows, Node v22.14.0).
What's the expected result?
Steps to Reproduce
- Create an Astro 5.17.1 project.
- Enable
<ClientRouter />in a common layout (e.g.,BaseLayout.astro). - Run the project in development or production mode.
- Open the network tab or monitor server-side logs.
- Navigate from one page to another (e.g.,
/to/product/sticker). - 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.