commit 0448bde9a9c451e1179bd43cd8e987b7e9ab5a47
parent ac50318c68faa931c50f8521623079600bd90823
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Wed, 9 Oct 2024 17:22:08 -0700
Update to current place in history in backend.push()
Before, it would push all of history to the server, but that's not
always what's wanted.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/files/floorplans/floorplan/backend.js b/files/floorplans/floorplan/backend.js
@@ -663,6 +663,7 @@ export class FloorplanBackend {
push() {
// WARNING: This needs a lock
+
let put = (this.history.truncated &&
(!this.lastUpdated || this.lastUpdated < this.history.truncated))
@@ -672,7 +673,8 @@ export class FloorplanBackend {
return this.putServer()
}
- let dirty = this.history.between(this.serverPosition, this.history.last)
+ let newpos = this.history.place
+ let dirty = this.history.between(this.serverPosition, newpos)
if (dirty.length === 0) {
console.log("Not updating server: already up to date")
return Promise.resolve()
@@ -695,7 +697,7 @@ export class FloorplanBackend {
let backend = this
return api.fetch("PATCH", this.endpoint, patch)
.then(function(data) {
- backend.serverPosition = dirty.at(-1).id
+ backend.serverPosition = newpos
updateIDs(backend, data)
for (let i in dirty) {
delete dirty[i].dirty