I am working on an Angular project with NGRX store and effect inside. I got a problem when using rxjs reducer operator, the observable chain somehow was stopped. No errors are shown on the console.
@Injectable()
export class MyEffects {
@Effect()
public grouping$: Observable<Action> = this.actions$.pipe(
ofType(FIRST_ACTION),
map((action) => action.payload),
flatMap(i => i),
groupBy((i) => i.code),
flatMap(group$ => {
return group$.pipe(
reduce((acc, curr) => {
acc.push(curr);
console.log('%c curr', 'background-color:green;color:#fff', curr);
console.log('%c acc', 'background-color:green;color:#fff', acc);
return acc;
}, []),
tap(grpArr => console.log('group array', grpArr))
);
}),
switchMap((data) => {
return [new AnotherAction()];
})
);
}
My concern is on the line
tap(grpArr => console.log('group array', grpArr))
The reducer operators logs the right output in the console. But when I tap the result, they are not showing. And of course the last switchMap operator not trigger since the chain is stopped. Am I missing something here?
