Action doesn’t trigger effect the THIRD time when it runs

Tags: , , , ,



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()),
            )
            ),
    );

Answer

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?



Source: stackoverflow