Skip to content

Commit

Permalink
fix: errors when reading optional queries
Browse files Browse the repository at this point in the history
Some optional queries were incorrectly marked as required which was throwing runtime errors.
  • Loading branch information
crisbeto committed Oct 10, 2024
1 parent 4197b8e commit b3faeab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/pages/component-sidenav/component-sidenav.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</mat-sidenav>
}
<div class="docs-component-sidenav-content">
<component-page-header (toggleSidenav)="toggleSidenav(sidenav())"></component-page-header>
<component-page-header (toggleSidenav)="toggleSidenav()"></component-page-header>
<div class="docs-component-sidenav-inner-content">
<main class="docs-component-sidenav-body-content">
<!-- If on large screen, menu resides to left of content -->
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/component-sidenav/component-sidenav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const SMALL_WIDTH_BREAKPOINT = 959;
],
})
export class ComponentSidenav implements OnInit, OnDestroy {
readonly sidenav = viewChild.required(MatSidenav);
readonly sidenav = viewChild(MatSidenav);
params: Observable<Params> | undefined;
isExtraScreenSmall: Observable<boolean>;
isScreenSmall: Observable<boolean>;
Expand Down Expand Up @@ -120,8 +120,8 @@ export class ComponentSidenav implements OnInit, OnDestroy {
this.subscriptions.unsubscribe();
}

toggleSidenav(sidenav: MatSidenav): Promise<MatDrawerToggleResult> {
return sidenav.toggle();
toggleSidenav(): void {
this.sidenav()?.toggle();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/component-viewer/component-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class ComponentViewer implements OnDestroy {
*/
@Directive()
export class ComponentBaseView implements OnInit, OnDestroy {
readonly tableOfContents = viewChild.required<TableOfContents>('toc');
readonly tableOfContents = viewChild<TableOfContents>('toc');
readonly viewers = viewChildren(DocViewer);

showToc: Observable<boolean>;
Expand Down

0 comments on commit b3faeab

Please sign in to comment.