-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
a1f2633
commit ac89400
Showing
2 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters