From 89b1c88823bbb90392dd596646f0b7e8e4986957 Mon Sep 17 00:00:00 2001 From: Massimo Candela Date: Sun, 27 Feb 2022 17:22:56 +0100 Subject: [PATCH] fixed resolution of inexistent promise --- src/PersistentStore.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/PersistentStore.js b/src/PersistentStore.js index 81923fa..0f9bc62 100644 --- a/src/PersistentStore.js +++ b/src/PersistentStore.js @@ -152,9 +152,12 @@ export default class PersistentStore extends Store{ return new Promise((resolve, reject) => { if (this.options.autoSave) { if (this._delayedSaveTimer) { - this._delayedSavePromise(); - this._delayedSavePromise = null; + if (this._delayedSavePromise) { + this._delayedSavePromise(); + this._delayedSavePromise = null; + } clearTimeout(this._delayedSaveTimer); + this._delayedSaveTimer = null; } this._delayedSavePromise = resolve; this._delayedSaveTimer = setTimeout(() => {