0

I am trying to implement effects with my reducers to get data from rest api. But its throwing RangeError: Maximum call stack size exceeded The effect code is invoked in a loop for some reason i don't understand

My Effect code is

 @Effect()
 fetchCadList$ = this.action$.ofType(AppAction.LOAD_CADLIST)
  .map(toPayload)
  .switchMap( cadList=>
    Observable.of({type:AppAction.LOAD_CADLIST_SUCCESS,payload:this.cadService.fetchCadList()})
);

reducer looks like this

switch (action.type) {
   case AppAction.LOAD_CADLIST: break;
   case AppAction.LOAD_CADLIST_SUCCESS:
   return Object.assign({}, state.cadList, action.payload);
    default:
    return state;
 }

it only happens when i use Observable for an action

Ravi Jadhav
  • 81
  • 1
  • 11

1 Answers1

0

The issue was with Action definition . The issue has been pointed out in

Infinite loop with ngrx/effects

Ravi Jadhav
  • 81
  • 1
  • 11