numtel / meteor-mysql

Reactive MySQL for Meteor
MIT License
343 stars 41 forks source link

ready() returns false even when subscription is fully loaded #13

Open andycjw opened 9 years ago

andycjw commented 9 years ago

might be related to issue #11 ready() now returns false when subscription is fully loaded, and it's not reactive.

numtel commented 9 years ago

Can you provide a repo with minimal code to reproduce this that I can clone? I am not seeing this issue with the leaderboard example.

andycjw commented 9 years ago

this ready() is for the .change() call, or there's no ready() for query change made with .change()

i'll try to make a minimal code base to see if I can reproduce this with certain.

andycjw commented 9 years ago

I tried to created a tinytest for this issue in this commit below, not sure if it's correct, can you take a look at it? It fail the test, but I'm not certain I did the test correctly, andycjw@06f62465bbf901f779dfb525ba920248913de170

numtel commented 9 years ago

I have added checks of the ready() method to the change() method test: https://github.com/numtel/meteor-mysql/commit/017bdf26258cbd582c55a4e08e88641b2b510f41

Putting tracker.autorun in a test case (with the way my tests are set up in this package anyways) will cause problems because it will not stop when other tests are running.

andycjw commented 9 years ago

okay, the issue I saw only happen during invalidation of MysqlSubscription caused by .change(), it will give ready() as True when it first invalidated, but .length is not correct. How should we test this? Is there any way to the the reactive ready() is correct, I think setTimeout doesn't catch that