Problems with subscriptions


#1

I have a subscription that returns a collections called Updates. These Updates are specific to the user and assist them in getting to a discussion. Each of the updates have their own template that have their own subscription. In each of the template it is supposed to subscribe only to the updates that are specific to that discussion. The problem seems to be that the when Meteor has more than one subscription of different discussions but the same subscription, it doesn’t load properly.

[ Update: discussion 001 of user 01] [Update: users of discussion 001]
[ Update: discussion 002 of user 01] [Update: users of discussion 002]
[ Update: discussion 003 of user 01] [Update: users of discussion 003]

Each of these are templates with their own subscriptions and I don’t know how to properly subscribe in them. It seems Meteor doesn’t unsubscribe as it should unsubscribe. I have Updates that appear in on templates that it shouldn’t appear, but it is of the same subscription.

[ discussions template ] [ discussion 000 template ]

What is the appropriate way of addressing this problem?


#2

You may just be seeing expected behaviour:

If you are never seeing old data being removed, then you may not be subscribing correctly. For example, if you use Meteor.subscribe() then you will have to manage your own subscription lifecycle. On the other hand, in a Blaze onCreated template, this.subscribe() will be stopped for you when the template is removed from the DOM.


#3

Actually, I’m using viewmodel and I don’t know the appropriate implementation of it. The subscriptions seem to be conflicting with each other.


#4

Are the subscriptions subscribing to the same document Id but different sub documents? Or are you using sub documents at all?