When new SaveModelAction() is called, the corresponding Effect gets stuck in an infinite loop.
This the effect:
@Effect() saveModelAction = this.action$.pipe(
ofType(SAVE_MODEL),
switchMap((action: any) => {
const storageMetaData: StorageData = action.payload;
return this.modelService.loadState()
.pipe(
switchMap((state: State) => {
const model: Model = AnalysisUtils.convertStateToModel(state, storageMetaData);
return this.modelService.saveModel(model)
.pipe(
map(() => new SavingModelCompleteAction),
catchError((error: Error) => this.createErrorObservableAndLog(error))
);
}),
catchError((error: Error) => this.createErrorObservableAndLog(error))
);
})
);
Additional info:
Within the relevant component, the SaveModelAction is only disptached once.
When subscribing to the state at this.modelService.loadState(), take(1) is used.
this.modelService.saveModel(model) does nothing except sending the model to the backend (and returning an observable.
Can anyone point me in the right direction on where my issue is? Thanks!
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)