Skip to content

Commit

Permalink
DON-904: Fix TypeError on headerEl.closeMobileMenuFromOutside
Browse files Browse the repository at this point in the history
Not sure if this is related to the DON-904 error, but it's an avoidable
crash and it could be related
  • Loading branch information
bdsl committed Nov 1, 2023
1 parent 9651617 commit c9cca60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ export class AppComponent implements AfterViewInit, OnInit {
const headerEl = this.header;
this.router.events.pipe(
filter((event: RouterEvent) => event instanceof NavigationStart),
).subscribe(() => headerEl.closeMobileMenuFromOutside());
).subscribe(
// we have seen TypeError: Cannot read properties of undefined (reading 'closeMobileMenuFromOutside'). So check headerEl is defined beofore reading the prop:
() => headerEl && headerEl.closeMobileMenuFromOutside()
);
}

@HostListener('cookieBannerAcceptAllSelected', ['$event'])
Expand Down

0 comments on commit c9cca60

Please sign in to comment.