You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a normal setting, I can set up a simple autorun loop and reactively update a subscription, for example to increase a limit.
Meteor.autorun(function () {
var limit = Session.get('postLimit'); //Default at 5
Meteor.subscribe('threads', limit);
});
and with a regular publication this works great. If I change postLimit to 6, one additional post will appear increasing the total posts on screen to 6.
However if I unblock the publication, it is now executing asynchronously which causes the subscriptions to pile up every time I change the limit, leaving something that simulates
Which on its own wouldn't be the worst thing in the world, but the results are not merged. The above example would occur if I were to set the postLimit (which starts at 5) to 6, and then to 7. Instead of displaying 7 posts, it displays 18, like so.
I forget exactly why I figured it was happening, but I stopped unblocking
the publication to avoid the problem. I think it detached the content from
the subscription handler.
In a normal setting, I can set up a simple autorun loop and reactively update a subscription, for example to increase a limit.
and with a regular publication this works great. If I change
postLimit
to 6, one additional post will appear increasing the total posts on screen to 6.However if I unblock the publication, it is now executing asynchronously which causes the subscriptions to pile up every time I change the limit, leaving something that simulates
Which on its own wouldn't be the worst thing in the world, but the results are not merged. The above example would occur if I were to set the
postLimit
(which starts at 5) to 6, and then to 7. Instead of displaying 7 posts, it displays 18, like so.A similar effect was documented in the blog post I'll link to below. He ran into this problem using lodash debounce.
http://blog.east5th.co/2015/01/19/the-dangers-of-debouncing-meteor-subscriptions/
The text was updated successfully, but these errors were encountered: