Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function initialize(appInstance: ApplicationInstance): void {

function getTransitionInformation(transition: any, router: any) {
const fromRoute = transition?.from?.name;
const toRoute = transition ? transition.to.name : router.currentRouteName;
const toRoute = transition && transition.to ? transition.to.name : router.currentRouteName;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how it can happen but, in my EmberJS project using ember-simple-auth after a login the transition object from the login page to the default authenticated page contains no to key.
route.currentRouteName is well defined.

This defensive programming contribution fixes my issue.

return {
fromRoute,
toRoute,
Expand Down