fix: do not display "saved" message if some request failed (#2669)

This commit is contained in:
Yohan Boniface 2025-04-23 17:39:59 +02:00 committed by GitHub
commit 41752bd0c6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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

@ -695,7 +695,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