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
I'm working with FlowRouter and I'm declaring one instance of SubsManager() per collection in the file client/helpers/flow-router like this:
DPASubs = new SubsManager();
OrganizacionesSubs = new SubsManager();
CialcosSubs = new SubsManager();
UsersSubs = new SubsManager();
InviteSubs = new SubsManager();
InvitationsSubs = new SubsManager();
An example of how I'm using these instances in a template is:
Template.nuevoProductor.onCreated(function () {
let self = this;
self.ready = new ReactiveVar();
self.autorun(function() {
let handleDPA = DPASubs.subscribe('dpa');
let handleOrganizaciones = OrganizacionesSubs.subscribe('organizaciones');
let handleCialcos = CialcosSubs.subscribe('cialcos');
self.ready.set(handleDPA.ready());
self.ready.set(handleOrganizaciones.ready());
self.ready.set(handleCialcos.ready());
});
});
So my questions are:
Do I need an instance of SubsManager for each collection? or only one global instance?
Where should I declare this/these instance/s of SubsManager?
The text was updated successfully, but these errors were encountered:
1.Do I need an instance of SubsManager for each collection? or only one global instance?
It's upto you. Think like this. If used a one, all the publications are cached like the same. So, try to keep up with the cacheOptions. (Specially the cacheLimit option)
Other case is the invalidation. If used one, it any subscription added to the cache. All other places uses sub.ready() will re-run. It may cause some perf issues.
2.Where should I declare this/these instance/s of SubsManager?
May be in the same place as you declare collections.
Dear Arunoda,
I'm working with FlowRouter and I'm declaring one instance of SubsManager() per collection in the file
client/helpers/flow-router
like this:An example of how I'm using these instances in a template is:
So my questions are:
The text was updated successfully, but these errors were encountered: