Skip to content

Commit 5949373

Browse files
arturovtAndrewKushnir
authored andcommitted
fix(router): handle errors from view transition readiness (#62535)
This commit adds a `.catch()` handler to `transition.ready` from `document.startViewTransition` to prevent `AbortError`s in Safari when `startViewTransition` is called synchronously multiple times. PR Close #62535
1 parent 22b56ca commit 5949373

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/router/src/utils/view_transition.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ export function createViewTransition(
9494
// complete (below), which includes the update phase of the routed components.
9595
return createRenderPromise(injector);
9696
});
97+
transition.ready.catch((error) => {
98+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
99+
console.error(error);
100+
}
101+
});
97102
const {onViewTransitionCreated} = transitionOptions;
98103
if (onViewTransitionCreated) {
99104
runInInjectionContext(injector, () => onViewTransitionCreated({transition, from, to}));

0 commit comments

Comments
 (0)