NGRX : createReducer is hitting even the action is not called

Viewed 93

My reducer function is in a feature module. When I try to lazy load another module as a child to this feature module, the reducer function gets triggered.

export const sessionReducer = createReducer( initialSessionState, on(SessionActions.loadSessionDetails, (state, request) => { debugger; return ({ ...state, loading: true, error: '', request: request })
}), );

1 Answers

That's probably because the action SessionActions.loadSessionDetails is dispatched somewhere in the application. An action is send to all reducers, so if that feature module is loaded, it receives actions from other features.

Related