Skip to content

Commit

Permalink
fix(Scheduler): onAppointmentFormOpening event form change case
Browse files Browse the repository at this point in the history
  • Loading branch information
wdevfx committed Feb 21, 2025
1 parent bb756a6 commit c045af9
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,24 @@ export class AppointmentForm {
date: Date,
): void {
timeZoneUtils.getTimeZoneLabelsAsyncBatch(date)
.catch(() => [])
.then((timezones) => {
.catch(() => [] as TimezoneLabel[])
.then(async (timezones) => {
const store = dataSource.store();

store.remove(selectedTimezoneLabel?.id).catch(() => {});
timezones.forEach((timezone) => { store.insert(timezone).catch(() => {}); });
await store.remove(selectedTimezoneLabel?.id);

// NOTE: Unfortunately, our store not support bulk operations
// So, we update it record-by-record
const insertPromises = timezones.reduce<Promise<void>[]>((result, timezone) => {
result.push(store.insert(timezone));
return result;
}, []);

// NOTE: We should wait for all insertions before reload & repaint
await Promise.all(insertPromises);

dataSource.reload();
this.form.repaint();
}).catch(() => {});
}

Expand Down

0 comments on commit c045af9

Please sign in to comment.