fix: do not display "saved" message if some request failed

This commit is contained in:
Yohan Boniface 2025-04-23 08:57:26 +02:00
parent 05493d8a48
commit 4c71710641
2 changed files with 4 additions and 2 deletions

View file

@ -225,13 +225,14 @@ export class SyncEngine {
}
for (const [obj, operations] of needSave.entries()) {
const ok = await obj.save()
if (!ok) break
if (!ok) return false
for (const operation of operations) {
operation.dirty = false
}
}
this.saved()
this._undoManager.toggleState()
return true
}
saved() {

View file

@ -691,7 +691,8 @@ export default class Umap {
if (!this.isDirty) return
if (this._defaultExtent) this._setCenterAndZoom()
this.backup()
await this.sync.save()
const status = await this.sync.save()
if (!status) return
// Do a blind render for now, as we are not sure what could
// have changed, we'll be more subtil when we'll remove the
// save action