Skip to content

Commit

Permalink
Update navigation-narrator.js (#384)
Browse files Browse the repository at this point in the history
Adds `?` check for `from.name`
  • Loading branch information
MelSumner authored Aug 13, 2024
1 parent 7fe1789 commit 0288769
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions addon/components/navigation-narrator.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default class NavigationNarratorComponent extends Component {
*/
get hasQueryParams() {
if (
Object.keys(this.transition.from.queryParams || {}).length ||
Object.keys(this.transition.from?.queryParams || {}).length ||
Object.keys(this.transition.to.queryParams).length > 0
) {
return true;
Expand All @@ -107,8 +107,8 @@ export default class NavigationNarratorComponent extends Component {
let shouldFocus;
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 (question: what if the user refreshes the page?)
let hasSameRoute = this.transition.from.name === this.transition.to.name;
// add a check to see if it's the same route
let hasSameRoute = this.transition.from?.name === this.transition.to.name;

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

0 comments on commit 0288769

Please sign in to comment.