From f004270fbe6326cf69a54e33a17a5bc79ca05b7e Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 25 May 2018 21:41:29 +0900 Subject: [PATCH] super selectOne --- @overflow/probe/container/probe-detail-container.ts | 4 ++-- @overflow/probe/store/index.ts | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/@overflow/probe/container/probe-detail-container.ts b/@overflow/probe/container/probe-detail-container.ts index a5d8cc9..e3dcf9b 100644 --- a/@overflow/probe/container/probe-detail-container.ts +++ b/@overflow/probe/container/probe-detail-container.ts @@ -13,7 +13,7 @@ import { RPCClientError } from '@loafer/ng-rpc'; }) export class ProbeDetailContainerComponent implements OnInit { - @Input() probeHostID; + @Input() probeHostID: number; @Output() discovery = new EventEmitter(); probeHost$: Observable; error$: Observable; @@ -22,10 +22,10 @@ export class ProbeDetailContainerComponent implements OnInit { private store: Store, private route: ActivatedRoute, ) { - this.probeHost$ = store.pipe(select(ProbeSelector.selectOne(this.probeHostID))); } ngOnInit() { + this.probeHost$ = this.store.pipe(select(ProbeSelector.selectOne(this.probeHostID))); this.store.dispatch(new ProbeStore.Read(this.probeHostID)); } diff --git a/@overflow/probe/store/index.ts b/@overflow/probe/store/index.ts index 87e8aa3..c73f431 100644 --- a/@overflow/probe/store/index.ts +++ b/@overflow/probe/store/index.ts @@ -8,23 +8,26 @@ import { StateSelector } from '@overflow/core/ngrx/store'; import { MODULE } from '../probe.constant'; -import * as ProbeStore from './entity/probe'; +import * as ProbeEntityStore from './entity/probe'; +import * as ProbeListContainerStore from './container/probe-list'; export interface State { - probes: ProbeStore.State; + probes: ProbeEntityStore.State; + probe_list_pending: ProbeListContainerStore.State; } export const REDUCERS = { - probes: ProbeStore.reducer, + probes: ProbeEntityStore.reducer, + probe_list_pending: ProbeListContainerStore.reducer, }; export const EFFECTS = [ - ProbeStore.Effects, + ProbeEntityStore.Effects, ]; export const selectState = createFeatureSelector(MODULE.name); -export const ProbeSelector = ProbeStore.getSelectors(createSelector( +export const ProbeSelector = ProbeEntityStore.getSelectors(createSelector( selectState, (state: State) => state.probes ));