next.js
e08fe27a - Restore RSC fetch error handling after navigating back (#73985)

Commit
1 year ago
Restore RSC fetch error handling after navigating back (#73985) As a follow-up to #73975, we're now restoring the error handling for failed RSC fetch calls when the user navigates back after a hard navigation. In this case the browser uses the bfcache to restore the previous JavaScript execution context, and thus the abort controller will still be in the aborted state. To take this into account, we're now creating a new `AbortController` instance on `'pageshow'` events. In addition, the abort controller's `signal` is now actually passed to the `fetch` call, and not only used for the error handling, so that the requests are aborted on `'pagehide'`. This was an oversight in the original PR. With that, it's even more important to create a fresh abort controller, otherwise RSC fetching would be disabled after back navigation. The added e2e test can only run in headed mode unfortunately, as the bfcache is not available in headless mode. (Using the same approach as in #54081.)
Author
Parents
Loading