Skip to content

Commit

Permalink
Protected Against Empty transition.to (#386)
Browse files Browse the repository at this point in the history
When a transition is aborted (and maybe at other times) transition.to is
null and needs to be guarded against just like transition.from.
  • Loading branch information
jrjohnson authored Aug 27, 2024
1 parent f78a491 commit fa56772
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions addon/components/navigation-narrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default class NavigationNarratorComponent extends Component {
get hasQueryParams() {
if (
Object.keys(this.transition.from?.queryParams || {}).length ||
Object.keys(this.transition.to.queryParams).length > 0
Object.keys(this.transition.to?.queryParams || {}).length > 0
) {
return true;
} else {
Expand All @@ -108,7 +108,7 @@ export default class NavigationNarratorComponent extends Component {
this.transition = transition; // We need to do this because we can't pass an argument to a getter

// add a check to see if it's the same route
let hasSameRoute = this.transition.from?.name === this.transition.to.name;
let hasSameRoute = this.transition.from?.name === this.transition.to?.name;

if (this.excludeAllQueryParams && this.hasQueryParams && hasSameRoute) {
return;
Expand Down

0 comments on commit fa56772

Please sign in to comment.