commit 74da044652bb859f083b57eda11222d664c22934
parent 83c9e84000582b3f84a71c9b9856e0b051b4954e
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sat, 19 Oct 2024 11:26:41 -0700
Fix bug in id mapping
When remapping, the old mapping wasn't removed, it's just a new one
was added. This might fix an issue I'v had with pushing invalid IDs
but I couldn't figure out how to reproduce it so no way of really
testing except waiting to see if it happens again (it wasn't too
infrequent.)
If it does stop, I expect the issue may have ocurred when one server
id was unmapped and the other was left, so on a patch it was used
to remap ids to. I'd have to look into it more to see if this was
possible.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/files/floorplans/floorplan/backend.js b/files/floorplans/floorplan/backend.js
@@ -998,7 +998,9 @@ export class FloorplanBackend {
if (localID == null || serverID == null) {
throw new Error("Requires local and server ID")
}
- if (!options.remap) {
+ if (options.remap) {
+ delete this.serverIDs[localID]
+ } else {
if (this.serverIDs[localID] != undefined) {
throw new Error("That local ID is already mapped to " + this.serverIDs[localID])
}