After refactoring you moved map
out of switchMap
projection, so any error will close the outer stream. To keep both streams equivalent, you need to use pipe
in the projection itself like that:
import { EMPTY } from 'rxjs';
// ...
@Effect()
loadData$ = this.actions$
.ofType(LOAD_DATA)
.pipe(
map((action: LoadData) => action.payload),
withLatestFrom(this.store.select(getCultureCode)),
switchMap(([payload, cultureCode]) =>
this.dataService.loadData(payload, cultureCode)
.pipe(
map(result => {
if (!result) {
return new LoadDataFailed('Could not fetch data!');
} else {
return new LoadDataSuccessful(result);
}
}),
catchError((err, caught) => {
return EMPTY;
})
)
)
);