AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Failed Request From Abandoned Navigation Triggers Full Page Reload

When a slow RSC fetch for a route fails after the user has navigated to another page via client-side navigation, Next.js incorrectly performs a full page load to the abandoned route's URL, disrupting the user experience.

highConfidence 85%Next.jsAffected V16.4.0-Canary.50

Origin Analysis

The router's error handling for server response failures does not verify whether the request is still active (i.e., whether the user is still on the same route). When the abandoned /slow request fails, the error handler triggers a full page reload to /slow, even though the router state has already moved to /other.
1. Create a Next.js app with two pages: /slow and /other. 2. Navigate to /slow via client-side Link, which initiates a slow server request (e.g., 2 seconds delay). 3. After 400ms, click Link to /other. 4. Observe that /other renders correctly. 5. When the /slow request fails around 2s, the browser unexpectedly performs a full page load to /slow.

Fixing Code Block

Edge Case Audit

This patch assumes that state.canonicalUrl is reliable and updated synchronously during navigation. In concurrent rendering or with multiple rapid navigations, there may be edge cases where the canonical URL has not been updated yet, leading to false negatives. Additionally, if the requested URL has the same pathname but different search params, the check may need to include the full URL including search. Test thoroughly with rapid successive navigations and slow network conditions. Rollback by removing this patch.

Ecosystem Topology