Skip to content

Commit

Permalink
Disable auto-saving before rendering data only (#995)
Browse files Browse the repository at this point in the history
- Fixes #994
- The previous patch for #910 is not needed anymore since we solved the general issue
  • Loading branch information
DmitrySharabin authored Nov 16, 2023
1 parent 559d477 commit d68e709
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/mavo.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ let _ = self.Mavo = $.Class(class Mavo {
$.bind(this.element, "mv-login.mavo", evt => {
if (evt.backend == (this.source || this.storage)) {
// If last time we rendered we got nothing, maybe now we'll have better luck?
if (this.inProgress !== "loading" && !this.root.data && !this.unsavedChanges) {
if (!this.root.data && !this.unsavedChanges) {
this.load();
}
}
Expand Down Expand Up @@ -546,9 +546,6 @@ let _ = self.Mavo = $.Class(class Mavo {
return;
}

let autoSaveState = this.autoSave;
this.autoSave = false;

if (data === undefined) {
this.inProgress = "loading";

Expand Down Expand Up @@ -588,13 +585,17 @@ let _ = self.Mavo = $.Class(class Mavo {
this.inProgress = false;
}

let autoSaveState = this.autoSave;
this.autoSave = false;

this.render(data);

this.autoSave = autoSaveState;

await Mavo.defer();

this.dataLoaded.resolve();
this.element.dispatchEvent(new CustomEvent("mv-load", {detail: backend, bubbles: true}));
this.autoSave = autoSaveState;
}

async store () {
Expand Down

0 comments on commit d68e709

Please sign in to comment.