@@ -13,8 +13,8 @@ import {MatSnackBar} from '@angular/material/snack-bar';
1313import { Observable , Subscription } from 'rxjs' ;
1414import { map , take } from 'rxjs/operators' ;
1515import Timeout = NodeJS . Timeout ;
16- import { DatabaseService } from " ../../services/database.service" ;
17- import { SwissDateAdapter } from " ../../../../shared/utils/format-datapicker" ;
16+ import { DatabaseService } from ' ../../services/database.service' ;
17+ import { SwissDateAdapter } from ' ../../../../shared/utils/format-datapicker' ;
1818
1919@Component ( {
2020 selector : 'app-day-overview' ,
@@ -55,7 +55,7 @@ export class DayOverviewComponent implements OnChanges, OnInit, OnDestroy {
5555 }
5656
5757 ngOnDestroy ( ) : void {
58- this . specificMealsSubscription . unsubscribe ( ) ;
58+ this . specificMealsSubscription ? .unsubscribe ( ) ;
5959 }
6060
6161
@@ -96,10 +96,17 @@ export class DayOverviewComponent implements OnChanges, OnInit, OnDestroy {
9696
9797 const empties = this . dayElement ?. nativeElement . querySelectorAll ( '[data-add-note="true"]' ) ;
9898
99+ // TODO: including this leads to performance issues
100+ /*
99101 if (empties === undefined || empties.length === 0) {
100- setTimeout ( ( ) => this . setContextMenu ( ) , 250 ) ;
102+ setTimeout(() => {
103+ console.log("setContextMenu_timeout2");
104+ this.setContextMenu();
105+ }, 250);
101106 return;
102107 }
108+ */
109+
103110
104111 empties . forEach ( empty => {
105112
@@ -136,10 +143,7 @@ export class DayOverviewComponent implements OnChanges, OnInit, OnDestroy {
136143
137144 } ) ;
138145
139- if ( this . specificMealsSubscription ) {
140- this . specificMealsSubscription . unsubscribe ( ) ;
141- }
142-
146+ this . specificMealsSubscription ?. unsubscribe ( ) ;
143147 this . specificMealsSubscription = this . specificMeals . subscribe ( meals => meals . forEach ( meal => {
144148
145149 const elements = document . querySelectorAll ( '[data-meal-id=ID-' + meal . documentId + ']' ) ;
0 commit comments