Subscriptions inside composer
aykutyaman opened this issue · comments
What is the best way to do multiple subscriptions inside to the composer function. I do in this way up until now:
export const composer = ({context, companyId}, onData) => {
const {Meteor, Collections} = context();
const handle1 = Meteor.subscribe('vehicles.list', companyId);
const handle2 = Meteor.subscribe('companies.single', companyId);
if (handle1.ready() && handle2.ready()) {
const vehicles = Collections.Vehicles.find().fetch();
const company = Collections.Companies.findOne();
onData(null, {vehicles, company});
}
};
Or do I have to do something like multiple composers for subscriptions. multiple composers
I think you've the correct way to handle it. Using multiple composer for this purpose is not a good idea. Use multiple composers when dealing with multiple data sources.
Thank you