Fixed syncing

This commit is contained in:
Zakary Timson 2019-09-01 15:35:31 -04:00
parent ceced97496
commit 9848f53407

View File

@ -73,7 +73,7 @@ export class SyncService {
delete(...symbols) { delete(...symbols) {
let map = this.mapData.value; let map = this.mapData.value;
[map.circles, map.markers, map.measurements, map.polygons, map.polylines, map.rectangles] [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.mapData.next(map);
this.mapChanged = true; this.mapChanged = true;
} }
@ -127,7 +127,7 @@ export class SyncService {
if(!locationOnly && this.mapDoc && this.mapChanged) { if(!locationOnly && this.mapDoc && this.mapChanged) {
let map = this.mapData.value; 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; delete map.locations;
let ignore = this.mapDoc.set(map); let ignore = this.mapDoc.set(map);
this.mapChanged = false; this.mapChanged = false;