Meteor.subscribe onReady callback called before sub marked ready #4614
Labels
Comments
Something just to watch out for: |
Not sure why this functionality happens -- maybe due to the flush cycle. In the meantime, |
Good point! I don't think anyone ever thought carefully about this, and it definitely makes sense the way you suggest. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Meteor Team!
I had a question about these lines of code: https://github.com/meteor/meteor/blob/master/packages/ddp/livedata_connection.js#L1377-L1379
When we receive a ready message for a subscription we call the
readyCallback
before actually marking the subscription as ready. Is there a reason for this? I want to achieve the following but cannot:Lets say we have a subscription called
someSub
that publishes some interesting data. This interesting data is used bygetSomeData()
. I want to make sure that developers on my team dont call getSomeData until thesomeSub
subscription is ready, since it could lead to unpredictable and particularly buggy state.Now, in the example below, I call getSomeData within the onReady callback function, and it still throws an error.
inside
getSomeData
This may just be an edge case, but to me. it seems that
ready()
should return true from inside thereadyCallback
. What do you think?The text was updated successfully, but these errors were encountered: