Issue
RXjs lastValueFrom documentation states:
WARNING: Only use this with observables you know will complete. If the source observable does not complete, you will end up with a promise that is hung up, and potentially all of the state of an async function hanging out in memory.
Does this mean "know will EMIT complete", or "know will end at some point by either emitting complete or error?" This is causing confusion on our team because HTTPclient sometimes emits error instead of complete, and we can not determine from documentation if this will cause the promise to 'hang up and hang out in memory."
Solution
Consider
lastValueFrom(interval(1000))
This will return a promise that will never resolve. This is what they're talking about. Errors won't be a problem.
So the answer to your question is "know will end at some point by either emitting complete or error"... except I don't know that it makes sense to say "emit complete". EMPTY
, for example, is an observable that completes, but it doesn't emit anything.
Answered By - JSmart523
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.