-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Problem:
Currently, you must pass an ActionReducerMap to StoreModule.forFeature(featureName: string, reducers: ActionReducerMap<any, any>). Sometimes, a feature module only needs a single reducer to be registered. By not allowing this, it will add an unnecessary intermediate step to get to the desired state.
Proposal:
Allow for StoreModule.forFeature(featureName: string, reducer: ActionReducer<any, any>).
Current functionality:
State interfaces
export interface PilotsModuleState {
pilot: PilotState;
}
export interface PilotState {
pilots: Pilot[]
}feature.module.ts
imports: [
...,
StoreModule.forFeature('pilotsModule', { pilot: pilotReducer })
]Feature selectors:
const selectPilotsModule = createFeatureSelector<PilotsModuleState>('pilotsModule');
const selectPilotsState = createSelector(selectPilotsModule, (state: PilotsModuleState) => state.pilot);
const selectPilots = createSelector(selectPilotsState, (state: PilotState) => state.pilots);Desired functionality:
State interfaces
export interface PilotsModuleState {
pilots: Pilot[]
}feature.module.ts
imports: [
...,
StoreModule.forFeature('pilotsModule', pilotReducer)
]Feature selectors:
const selectPilotsModule = createFeatureSelector<PilotsModuleState>('pilotsModule');
const selectPilots = createSelector(selectPilotsState, (state: PilotsModuleState) => state.pilots);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels