Return null instead of resolved promise to avoid extra calls

This commit is contained in:
nathan 2023-05-11 13:41:04 -06:00
parent c504de5def
commit 97a874342f
3 changed files with 14 additions and 6 deletions

View File

@ -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<any>
async _fetch_group_members(event) : Promise<any> | null
{
let groups = [];
let option_owner = null;
@ -3801,7 +3801,7 @@ export class CalendarApp extends EgwApp
}
else
{
return Promise.resolve();
return null;
}
}

View File

@ -384,7 +384,12 @@ export class et2_calendar_daycol extends et2_valueWidget implements et2_IDetache
{
continue;
}
waitForGroups.push(((<CalendarApp>this.getInstanceManager().app_obj.calendar)._fetch_group_members(event)).then(() =>
let wait = (<CalendarApp>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 ||

View File

@ -1921,8 +1921,11 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
{
continue;
}
waitForGroups.push((<CalendarApp>app.calendar)._fetch_group_members(event.data));
let wait = (<CalendarApp>app.calendar)._fetch_group_members(event.data);
if(wait !== null)
{
waitForGroups.push(wait);
}
}
}
if(waitForGroups.length == 0)