diff --git a/cvat-core/src/logger.ts b/cvat-core/src/logger.ts index ee8362d68cef..97dfbb7c9585 100644 --- a/cvat-core/src/logger.ts +++ b/cvat-core/src/logger.ts @@ -225,7 +225,8 @@ Object.defineProperties(Logger.prototype.save, { // potentially new events may be generated during saving // that is why we add this.collection this.collection = [...collectionToSend, ...this.collection]; - throw error; + + await Promise.reject(error); } finally { this.saving = false; } diff --git a/cvat-ui/src/components/cvat-app.tsx b/cvat-ui/src/components/cvat-app.tsx index 024d05652730..22898f153b63 100644 --- a/cvat-ui/src/components/cvat-app.tsx +++ b/cvat-ui/src/components/cvat-app.tsx @@ -135,7 +135,7 @@ class CVATApplication extends React.PureComponent window.document.hasFocus, userActivityCallback); - if (user) { - EventRecorder.initSave(); - } core.config.onOrganizationChange = (newOrgId: number | null) => { if (newOrgId === null) { diff --git a/cvat-ui/src/utils/event-recorder.ts b/cvat-ui/src/utils/event-recorder.ts index 639c0614bb2d..094effb2c712 100644 --- a/cvat-ui/src/utils/event-recorder.ts +++ b/cvat-ui/src/utils/event-recorder.ts @@ -53,17 +53,17 @@ class EventRecorder { public initSave(): void { if (this.#savingTimeout) return; this.#savingTimeout = window.setTimeout(() => { - const save = (): void => { + const scheduleSave = (): void => { this.#savingTimeout = null; this.initSave(); }; core.logger.save() - .then(save) + .then(scheduleSave) .catch((error) => { if (error?.code === 401) { this.cancelSave(); } else { - save(); + scheduleSave(); } }); }, CONTROLS_LOGS_INTERVAL);