How to cancel a running store.dispatch(xxx) action, so that the underlying http requests are canceled as well?
I tried to .unsubscribe() from a store.dispatch(new FetchSomeStuffOverHttp()) call and expected that the underlying http request is also canceled.
But it will continue to run, even if the httpClient's observable is returned by the action:
@Action(FetchStuffOverHttp)
fetchStuffOverHttp({ patchState }: StateContext<AuftragStateModel>) {
return this.httpClient.get(...)
.pipe(
tap((...) => { patchState(...) })
)
}
Is it the expected behaviour that store.dispatch(xxx).subscribe().unsubscribe() is not unsubscribing/canceling the httpClients observable?
In contrast, the { cancelUncompleted: true } option will cancel the underling http request.