From 97a874342fa6e7818231ab40efee9ee61b767623 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 11 May 2023 13:41:04 -0600 Subject: [PATCH] Return null instead of resolved promise to avoid extra calls --- calendar/js/app.ts | 6 +++--- calendar/js/et2_widget_daycol.ts | 7 ++++++- calendar/js/et2_widget_planner.ts | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/calendar/js/app.ts b/calendar/js/app.ts index 229e3b0f6d..2bdfc2148f 100644 --- a/calendar/js/app.ts +++ b/calendar/js/app.ts @@ -3759,9 +3759,9 @@ export class CalendarApp extends EgwApp * in a particular calendar. * * @param event - * @return Promise + * @return Promise| null */ - async _fetch_group_members(event) : Promise + async _fetch_group_members(event) : Promise | null { let groups = []; let option_owner = null; @@ -3801,7 +3801,7 @@ export class CalendarApp extends EgwApp } else { - return Promise.resolve(); + return null; } } diff --git a/calendar/js/et2_widget_daycol.ts b/calendar/js/et2_widget_daycol.ts index ec31040895..4c212dddef 100644 --- a/calendar/js/et2_widget_daycol.ts +++ b/calendar/js/et2_widget_daycol.ts @@ -384,7 +384,12 @@ export class et2_calendar_daycol extends et2_valueWidget implements et2_IDetache { continue; } - waitForGroups.push(((this.getInstanceManager().app_obj.calendar)._fetch_group_members(event)).then(() => + let wait = (this.getInstanceManager().app_obj.calendar)._fetch_group_members(event); + if(wait === null) + { + continue; + } + waitForGroups.push(wait.then(() => { if(event && event.date && et2_calendar_event.owner_check(event, this) && ( event.date === this.options.date || diff --git a/calendar/js/et2_widget_planner.ts b/calendar/js/et2_widget_planner.ts index affdeff4fe..b394ac1156 100644 --- a/calendar/js/et2_widget_planner.ts +++ b/calendar/js/et2_widget_planner.ts @@ -1921,8 +1921,11 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta { continue; } - - waitForGroups.push((app.calendar)._fetch_group_members(event.data)); + let wait = (app.calendar)._fetch_group_members(event.data); + if(wait !== null) + { + waitForGroups.push(wait); + } } } if(waitForGroups.length == 0)