Skip to content

Commit e08771b

Browse files
authored
Merge pull request #210 from wp99cp/develop
Fix performance issues
2 parents fc775de + ab8ea7b commit e08771b

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeal/menuplanung",
3-
"version": "1.14.12",
3+
"version": "1.14.13",
44
"license": "MIT",
55
"copyrights": "© 2019 - 2023 Cevi Züri 11 - eMeal Menüplanung",
66
"scripts": {

frontend/src/app/modules/application-module/components/day-overview/day-overview.component.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import {MatSnackBar} from '@angular/material/snack-bar';
1313
import {Observable, Subscription} from 'rxjs';
1414
import {map, take} from 'rxjs/operators';
1515
import 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 + ']');

frontend/src/app/modules/application-module/components/week-overview/week-overview.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,10 @@ export class WeekOverviewComponent implements OnInit, Saveable, AfterViewInit {
378378
}
379379

380380
private updateContextMenus() {
381-
this.dayOverviews.forEach(el => el.setContextMenu());
381+
this.dayOverviews.forEach(el => {
382+
console.log('update context menu');
383+
el.setContextMenu();
384+
});
382385
}
383386

384387
/**

0 commit comments

Comments
 (0)