Skip to content

Commit

Permalink
Update ApplicationInstance#visit to use followRedirects()
Browse files Browse the repository at this point in the history
The current implementation of `Transition#followRedirects()` is identical to the logic here: it catches rejections, and then checks for any other `activeTransition`. Therefore, this commit introduces no change in behavior.

But, if/when tildeio/router.js#335 lands, it will means we can take advantage of that fix for ApplicationInstance#visit.
  • Loading branch information
davidtaylorhq committed Nov 16, 2023
1 parent 32c669e commit d364d09
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/@ember/application/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,6 @@ class ApplicationInstance extends EngineInstance {
let handleTransitionReject = (error: any): unknown => {
if (error.error && error.error instanceof Error) {
throw error.error;
} else if (error.name === 'TransitionAborted' && router._routerMicrolib.activeTransition) {
return router._routerMicrolib.activeTransition.then(
handleTransitionResolve,
handleTransitionReject
);
} else if (error.name === 'TransitionAborted') {
throw new Error(error.message);
} else {
Expand All @@ -285,6 +280,7 @@ class ApplicationInstance extends EngineInstance {
// getURL returns the set url with the rootURL stripped off
return router
.handleURL(location.getURL())
.followRedirects()
.then(handleTransitionResolve, handleTransitionReject);
}

Expand Down

0 comments on commit d364d09

Please sign in to comment.