in Education by
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)

1 Answer

0 votes
by
I had the same issue, effect was stuck in an infinite loop and take(1) solved it for dispatching it only once. The problem was that I had 2 actions which had the same type :( This should work perfectly, so in case of infinite loop of effect or action, check the constants type :) Good luck everyone!

Related questions

0 votes
    When new SaveModelAction() is called, the corresponding Effect gets stuck in an infinite loop. This the ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    I have the automata S'-> S S -> a | XbY X -> ε | aZ | Y Y -> b | XX z ... JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 3, 2022 in Education by JackTerrance
0 votes
    I have to make this an infinite loop and also make it go back to the start when a wrong character ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 2, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 9, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 8, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 8, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 6, 2022 in Education by JackTerrance
0 votes
    I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 5, 2022 in Education by JackTerrance
0 votes
+1 vote
    What is an infinite loop in C-Programming?...
asked Nov 9, 2020 by JackTerrance
0 votes
    I need to react in a main process to random events happening in a child process. I have implemented ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 27, 2022 in Education by JackTerrance
0 votes
    I have an endless loop problem in Simpy simulation. My scenario is: After finishing triage, a patient wait ... ): admin_decision_prob = random.uniform(0, 1) if admin_decision_prob...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    Smriti wants to give output of a program in infinite loop which statement will you suggest to her to use? In qbasic Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    Write two points difference between Null loop and infinite loop Select the correct answer from above options...
asked Dec 17, 2021 in Education by JackTerrance
0 votes
    infinite for loop PYTHON Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
...