Skip to content

Commit

Permalink
Protected Against Empty transition.to
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 committed Aug 21, 2024
1 parent f78a491 commit d733beb
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 d733beb

Please sign in to comment.