From ab70153f084179b7f5db345e58ed646a1e6f9f2c Mon Sep 17 00:00:00 2001 From: Florian Spier Date: Tue, 24 Oct 2023 09:27:23 +0200 Subject: [PATCH] feat(signal-store): common --- libs/common/src/lib/models.ts | 3 --- libs/common/src/lib/reducer-manager.ts | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/libs/common/src/lib/models.ts b/libs/common/src/lib/models.ts index fd78a0fb..0ea9fc1e 100644 --- a/libs/common/src/lib/models.ts +++ b/libs/common/src/lib/models.ts @@ -29,7 +29,6 @@ export interface StoreConfig { initialState?: T; metaReducers?: MetaReducer[]; extensions?: StoreExtension[]; - combineReducersFn?: CombineReducersFn; } // Used for the Redux API: Store.feature / StoreModule.forFeature @@ -53,8 +52,6 @@ export type ReducerDictionary = { [p in keyof T]: Reducer; }; -export type CombineReducersFn = (reducers: ReducerDictionary) => Reducer; - export type StateOrCallback = | Partial | ((state: StateType) => Partial); diff --git a/libs/common/src/lib/reducer-manager.ts b/libs/common/src/lib/reducer-manager.ts index 87fb492c..275dbb0c 100644 --- a/libs/common/src/lib/reducer-manager.ts +++ b/libs/common/src/lib/reducer-manager.ts @@ -29,7 +29,7 @@ export function createReducerManager() { metaReducers: [], }; - let _reducer: Reducer; + let reducer: Reducer; function _updateStateAndReducer(v: Partial): void { state = { @@ -39,7 +39,7 @@ export function createReducerManager() { const combinedMetaReducer: MetaReducer = combineMetaReducers(state.metaReducers); const combinedReducer: Reducer = combineReducers(state.featureReducers); - _reducer = combinedMetaReducer(combinedReducer); + reducer = combinedMetaReducer(combinedReducer); } function setFeatureReducers(featureReducers: ReducerDictionary) { @@ -89,7 +89,7 @@ export function createReducerManager() { addFeatureReducer, removeFeatureReducer, addMetaReducers, - getReducer: () => _reducer, + getReducer: () => reducer, // Exported for testing _updateStateAndReducer, };