<collection>.observeAsync() does not block until initial results are delivered

The documentation on observeAsync() states:

Before observeAsync returns, added (or addedAt ) will be called zero or more times to deliver the initial results of the query.

This is true when the added() or addedAt() methods are synchronous but not true if they are asynchronous.

Is this something that can be addressed?

What version of Meteor are you using? It looks like in 2.16 async callbacks were not taken care of, but the latest sources seem to indicate otherwise.

Hi, the latest 3.1.2

If you think this is working as expected, I will go back and double check my experience …

This is the code that awaits initial add events:

But now that I look into it a bit more maybe tailable cursors are not handled (because there is no “initialization”):

Yes, sorry, I should have been clearer…

The added() is called before the observerAsync() returns, but the effect of the add is not present (i.e. the additions are not present).

So the overall effect is as if the added() had not been called at all so far as the state is concerned when observeAsync() returns.

Hope this helps

Nope makes sense. add is called during the initialization phase. The question is whether those calls are awaited before the initialization phase is considered done.