diff --git a/projects/common-map/src/fm-map/components/map/map.component.ts b/projects/common-map/src/fm-map/components/map/map.component.ts index 8c34a05..5f3be61 100644 --- a/projects/common-map/src/fm-map/components/map/map.component.ts +++ b/projects/common-map/src/fm-map/components/map/map.component.ts @@ -12,7 +12,7 @@ import * as mapActions from '../../actions/map.actions'; import { IMapState} from '../../models/map.state'; import { ISelectedFeatures } from '../../models/selected.features'; import { IItemLayer } from '../../models/item.layer'; -import { IQueryState } from '@farmmaps/common'; +import { IListItem, IQueryState } from '@farmmaps/common'; import { IPeriodState } from '../../models/period.state'; import {IStyles} from '../../models/style.cache'; import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component'; @@ -81,6 +81,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { public styles$:Observable = this.store.select(mapReducers.selectGetStyles); private lastUrl = ""; private initialized: boolean = false; + private rootItems: Observable = this.store.select(commonReducers.getRootItems); @ViewChild('map') map; @@ -122,6 +123,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit { } } }); + this.rootItems.subscribe((l) => { + if(l && l.length>0) { + this.store.dispatch(new mapActions.Init()); + } + }); } @HostListener('document:keyup', ['$event'])