Skip to content

Commit ebaf406

Browse files
committed
chore: .
1 parent 44d4ae9 commit ebaf406

File tree

1 file changed

+26
-0
lines changed
  • packages/router/src/navigation-api

1 file changed

+26
-0
lines changed

packages/router/src/navigation-api/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,32 @@ export function createNavigationApiRouter(options: RouterApiOptions): Router {
816816
) {
817817
// see above
818818
started = true
819+
const initialLocation = resolve(
820+
window.location.pathname +
821+
window.location.search +
822+
window.location.hash
823+
) as RouteLocationNormalized
824+
pendingLocation = initialLocation
825+
resolveNavigationGuards(initialLocation, START_LOCATION_NORMALIZED)
826+
.then(() => {
827+
finalizeNavigation(initialLocation, START_LOCATION_NORMALIZED)
828+
})
829+
.catch(err => {
830+
const failure = err as NavigationFailure
831+
if (
832+
isNavigationFailure(failure, ErrorTypes.NAVIGATION_GUARD_REDIRECT)
833+
) {
834+
return navigate((failure as NavigationRedirectError).to, {
835+
replace: true,
836+
})
837+
} else {
838+
return triggerError(
839+
failure,
840+
initialLocation,
841+
START_LOCATION_NORMALIZED
842+
)
843+
}
844+
})
819845
}
820846

821847
const reactiveRoute = {} as RouteLocationNormalizedLoaded

0 commit comments

Comments
 (0)