Open cdasilvacosta opened 1 year ago
Yes! This is indeed a bug. But fixing it may be considered a breaking change, as some existing application may depend on requests being fired without a subscribe()
, since that is the way it has always worked.
Will look into this.
But in the meantime, as a workaround you could defer the execution. Example (not tested):
import { defer } from "rxjs";
// This should not fire the request
const response$ = defer(() => this.miService.execute({
program: 'MNS150MI',
transaction: 'LstUserData',
}));
// This fires the request
response$.subscribe(response => ...)
Thanks for the answer.
Why not make a major update just to avoid that it impacts the current projects and report this correction in the release notes?
@anhallbe and @cdasilvacosta, I have prepared a PR #153.
Hello I have created a generic component that takes an observable as input and launches it only when I need it (to gain performance). When I call api through the HttpClient of angular, it works very well. But when I use the MIService execute, I see that the M3 api calls run without any subscription on it. Very simple example :
I looked at how the MIService was developed. From the moment the "execute" method is called, it executes the http request directly and stores the result in an observable. This can become very problematic and even generate big performance problems.