I'm new to Ngrx and am having issues setting up polling with Ngrx effects
I've tried the answer mentioned How to do http polling in ngrx effect but this does not seem to be working as expected for my solution. I have a feeling that this could be because of my return statement
LoadProcessesByUser$: Observable<Action> = this.actions$.pipe(
ofType(AppActions.LoadProcessesByUser),
switchMap(() => {
interval(100).pipe(
startWith(0),
mapTo(this.actions$)
);
return this.apiService.getUserProcesses(this.userService.user.lanId).pipe(
map(result => new LoadProcessesSuccess(result)),
catchError(error => of(new LoadFailure(error)))
);
})
);
I expected to see this effect being called every 100 ms but as it seems, it's only called whenever I dispatch LoadProcessByUser()
Do note; i want this polling to be running for the life of the application.
Thank you