commit ce3feaf4efb15a76bba6e7f59e0f506728c78648
parent 9f95a2d1c6fe6fa07458a5db1c57bf7b950e05d2
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Thu, 22 Aug 2024 10:46:13 -0700
Stop pushing updates from the server back to the server
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/files/floorplans/floorplan/backend.js b/files/floorplans/floorplan/backend.js
@@ -526,6 +526,12 @@ export class FloorplanBackend {
*/
pull() {
// WARNING: This probably needs a lock
+
+ // Since we set serverPosition below
+ if (this.history.place != this.serverPosition) {
+ throw new Error("Push updates first")
+ }
+
let backend = this
return api.fetch("GET", this.endpoint)
.then(function(data) {
@@ -533,6 +539,7 @@ export class FloorplanBackend {
console.debug("Backend.Pull (diff)", diff)
backend.applyDiff(diff, { clean: true })
backend.cb("pull")
+ backend.serverPosition = backend.history.place
})
}