www.spaceplanner.app

Web client to the spaceplanner API
git clone git://jacobedwards.org/www.spaceplanner.app
Log | Files | Refs

commit 2f4010bc436a84cf5d14a1771fe6c5a6cffa6e7e
parent 9c1de8bb7d321fdae42c8c4d1e7b1ddec03e8927
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Tue, 17 Sep 2024 12:54:21 -0700

Fix backend's putServer

It would call remapIDs which chokes when there isn't a defined
server ID. So now we just issue a warning and continue on, because
for my purposes it should always result in the "new" operation being
used anyway.

Diffstat:
Mfiles/floorplans/floorplan/backend.js | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/files/floorplans/floorplan/backend.js b/files/floorplans/floorplan/backend.js @@ -763,10 +763,13 @@ export class FloorplanBackend { for (let id in data[t]) { let nid = idMap[id] if (nid == null) { - if (idMap != this.localIDs) { - throw new Error("Cannot create server ID") + if (idMap == this.localIDs) { + nid = this.newID(objectTypes[t], id) + } else { + // For my purposes this will be fine. + console.warn("backend.remapIDs", "Not remapping; cannot create server ID") + nid = id } - nid = this.newID(objectTypes[t], id) } newdata[t][nid] = this.remapIDsValue(data[t][id], idMap) }