Repository navigation
Replies: 1 comment
|
To preserve const toOptionalPromise = source$ =>
lastValueFrom(source$, { defaultValue: undefined });
const tokenPromise = toOptionalPromise(authService.refreshToken());
const nonFatalPromise = toOptionalPromise(combineLatest([
serviceA.loadDataFromApiCall().pipe(catchError(() => EMPTY)),
serviceB.loadDataFromApiCall().pipe(catchError(() => EMPTY))
]));The migration guide describes this deliberate change: without a default, There is also a separate Finally, return the promise chain directly from the initializer: return () => Promise.all([tokenPromise, nonFatalPromise])
.then(() => undefined);Your |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
We recently migrated our rxjs package version in our project. Part of migration was replacing toPromise deprecated function with first/lastValueFrom function. A problem that was raised is the throw of an EmptyError due to the fact the some of our functions immediately returns an EMPTY observable, some of our functions are just an api calls that return EMPTY observable from the catchError operator:
Example:
This scenarios made me come up with 2 questions:
All reactions