Added sync freezing while editing symbols

This commit is contained in:
Zakary Timson 2019-09-08 12:13:32 -04:00
parent 12c04c366d
commit ae767f6a5d
2 changed files with 4 additions and 1 deletions

View File

@ -110,7 +110,7 @@ export class SyncService {
}).snapshotChanges(), this.freeze)
.pipe(map(data => {
let oldMap = this.mapData.value;
if(data[2]) return oldMap;
if(data[2]) return;
let newMap = data[0] || {};
let mergedMap = this.mergeMaps(newMap, oldMap);
@ -121,6 +121,7 @@ export class SyncService {
return mergedMap;
})).subscribe((mapData: MapData) => {
if(!mapData) return;
this.mapData.next(mapData);
this.status.next(null);
if(this.saveInterval) clearInterval(this.saveInterval);

View File

@ -110,7 +110,9 @@ export class MapComponent implements OnDestroy, OnInit {
this.map.click.pipe(filter(e => !!e)).subscribe(e => {
if(this.sub == null && e.symbol) {
if(e.symbol.noClick) return;
this.syncService.freeze.next(true);
this.sub = this.bottomSheet.open(EditSymbolComponent, {data: e, disableClose: true, hasBackdrop: false}).afterDismissed().pipe(finalize(() => this.sub = null)).subscribe(symbol => {
this.syncService.freeze.next(false);
this.syncService.delete(e.symbol);
if(e.item instanceof L.Circle) {
this.syncService.addCircle(symbol);