Skip to content

Commit 94dfebd

Browse files
committed
refactor(core): Reorder resolve/reject in relation to navigate[error/success]
Order was changed in whatwg/html#11512 (see that PR for details as to why). https://whatpr.org/html/10919/nav-history-apis.html#abort-a-navigateevent
1 parent e7cc89e commit 94dfebd

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/core/primitives/dom-navigation/testing/fake_navigation.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -963,12 +963,12 @@ function dispatchNavigateEvent({
963963
}
964964
navigation.navigateEvent = null;
965965
finishNavigationEvent(event, true);
966+
result.finishedResolve();
966967
const navigatesuccessEvent = new Event('navigatesuccess', {
967968
bubbles: false,
968969
cancelable: false,
969970
});
970971
navigation.eventTarget.dispatchEvent(navigatesuccessEvent);
971-
result.finishedResolve();
972972
(navigation.transition as InternalNavigationTransition)?.finishedResolve();
973973
navigation.transition = null;
974974
})
@@ -996,16 +996,14 @@ function dispatchNavigateEvent({
996996
} else if (this.interceptionState === 'intercepted') {
997997
this.interceptionState = 'finished';
998998
}
999+
result.committedReject(reason);
1000+
result.finishedReject(reason);
9991001
const navigateerrorEvent = new Event('navigateerror', {
10001002
bubbles: false,
10011003
cancelable,
10021004
}) as ErrorEvent;
10031005
(navigateerrorEvent as unknown as {error: Error}).error = reason;
10041006
navigation.eventTarget.dispatchEvent(navigateerrorEvent);
1005-
if (result.committedTo === null && !result.signal.aborted) {
1006-
result.committedReject(reason);
1007-
}
1008-
result.finishedReject(reason);
10091007
const transition = navigation.transition as InternalNavigationTransition | undefined;
10101008
transition?.committedReject(reason);
10111009
transition?.finishedReject(reason);

0 commit comments

Comments
 (0)