Skip to content

Commit 45896eb

Browse files
block upon preload
1 parent d70a914 commit 45896eb

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

packages/router-core/src/router.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,15 +2345,13 @@ export class RouterCore<
23452345
// there is a loaderPromise, so we are in the middle of a load
23462346
if (prevMatch.loaderPromise) {
23472347
// do not block if we already have stale data we can show
2348-
if (prevMatch.status === 'success' && !sync) {
2349-
// if the ongoing load is a preload, make sure to execute redirects
2350-
if (prevMatch.preload) {
2351-
prevMatch.loaderPromise.catch((err) => {
2352-
if (isRedirect(err)) {
2353-
return this.navigate(err.options)
2354-
}
2355-
})
2356-
}
2348+
// but only if the ongoing load is not a preload since error handling is different for preloads
2349+
// and we don't want to swallow errors
2350+
if (
2351+
prevMatch.status === 'success' &&
2352+
!sync &&
2353+
!prevMatch.preload
2354+
) {
23572355
return this.getMatch(matchId)!
23582356
}
23592357
await prevMatch.loaderPromise

0 commit comments

Comments
 (0)