From 9848f5340741ef593eef5553fafde0083d2fc421 Mon Sep 17 00:00:00 2001 From: ztimson Date: Sun, 1 Sep 2019 15:35:31 -0400 Subject: [PATCH] Fixed syncing --- src/app/services/sync.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/services/sync.service.ts b/src/app/services/sync.service.ts index 4cd58d6..cfcec4e 100644 --- a/src/app/services/sync.service.ts +++ b/src/app/services/sync.service.ts @@ -73,7 +73,7 @@ export class SyncService { delete(...symbols) { let map = this.mapData.value; [map.circles, map.markers, map.measurements, map.polygons, map.polylines, map.rectangles] - .forEach((storage: MapSymbol[]) => symbols.forEach(s => storage = storage.filter(ss => !_.isEqual(s, ss)))); + .forEach((storage: MapSymbol[]) => symbols.forEach(s => storage = (storage || []).filter(ss => !_.isEqual(s, ss)))); this.mapData.next(map); this.mapChanged = true; } @@ -127,7 +127,7 @@ export class SyncService { if(!locationOnly && this.mapDoc && this.mapChanged) { let map = this.mapData.value; - Object.values(map).forEach(val => val.filter(s => s.new).forEach(s => delete s.new)); + Object.values(map).filter(val => Array.isArray(val)).forEach(val => val.filter(s => s.new).forEach(s => delete s.new)); delete map.locations; let ignore = this.mapDoc.set(map); this.mapChanged = false;