Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I found out that problem is from not considering nodejs feature. Commented Sep 5 at 6:10
  • conclusion is need to consider microtask and event loop on this example code, when converting Promise to Observable by using from() or defer(). I thought that converted promise immediately returns values in callback of swtichMap() and returing is handled on test() execution. but, it is handled on asynchornously and seemed to be queued in microtask q. Commented Sep 5 at 6:34
  • adding delay() pipe-operator gave me hint. when I set delay 0s, I got expected result. Due to delay() queues userInfo$ execution on microtask queue, userInfo$ exeuction runs after test() execution. since there is no task on callstak , test() has been done already, converted Promise returns value immediately to userInfos$. Commented Sep 5 at 6:40