The problem is the Effect.
@Effect()
patient: Observable<any> = this.actions.pipe(
ofType(PatientActionTypes.PATIENT_FETCH),
tap((action: ActionTemplate<PatientFetch>) => {
const patient: any = this.storageService.get(STORAGE_KEY, {});
return patientActionFactory.create<PatientFetchSuccess>(PatientActionTypes.PATIENT_FETCH_SUCCESS, patient);
})
);
The above keeps dispatching the PATIENT_FETCH
action, and picks it up again - resulting in an infite loop. From looking at the code you probably want to return the PATIENT_FETCH_SUCCESS
action. Therefore, you must replace the tap
operator with the map
operator.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…