2
votes

Effects runs perfectly on first two dispatch of action but doesn't trigger on the third time.The solution in Why action doesn't trigger Effect the second time it runs and @ngrx Effect does not run the second time doesn't work for me. Here's the effect:

@Effect()
    getRoomsByRoomsList: Observable<IAction>  = this.actions$.pipe(
        ofMap(commonEuropeanParliamentActions.GET_ROOMS_BY_ROOMS_LIST),
        withLatestFrom(this.store, (action, state) => ({state: state, action: action})),
        exhaustMap((pAction: IStateAction) => 
            this.getRooms(pAction).pipe(
                switchMap((entity: any) => [
                    commonEuropeanParliamentActions.getSuccessRoomsByRoomsList(entity),
                    commonEuropeanParliamentActions.getSchedule(entity)
                ]),
                catchError(() => of()),
            )
            ),
    );
1
do you really want exhaustMap here? Why not mergeMap?user3155561
@Knostradamus Its not working in the mergeMap.Seba Cherian

1 Answers

2
votes

I also had a similar problem. The issue was with my reducer. In my reducer some error occurred which wasn't handled, as a result, the effect stopped working.

Could you check if that's the issue in your case too, if no other solutions worked?