next.js
ac89400a - Ignore RSC fetch errors after hard navigation (#73975)

Commit
1 year ago
Ignore RSC fetch errors after hard navigation (#73975) When the user reloads the page or navigates away while RSC fetch requests are still in flight – most notably background prefetches – we currently log the following error: ``` Failed to fetch RSC payload for <URL>. Falling back to browser navigation. ``` This unnecessarily clutters the DevTools console and creates noise in remote error reporting tools. When the browser cancels a `fetch` request due to navigation, it throws `TypeError: Failed to fetch`. We shouldn't universally suppress this error since it may also occur for other valid reasons where we do want to log it. To suppress the error only in genuine navigation scenarios, we introduce an `AbortController` and pass its signal to the `fetch` call. On `'pagehide'` events, we abort the controller. This approach ensures that error log suppression is limited solely to these navigation-related cases. [x-ref](https://vercel.slack.com/archives/C0676QZBWKS/p1734009715952909) fixes #60549
Author
Parents
Loading