Skip to content

Commit

Permalink
fixed resolution of inexistent promise
Browse files Browse the repository at this point in the history
  • Loading branch information
massimocandela committed Feb 27, 2022
1 parent 6626e21 commit 89b1c88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PersistentStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit 89b1c88

Please sign in to comment.