Hello everyone! In my app, I have a template where I load a big set of conversations. I subscribe to set of data in onCreated callback:
Template.chat.onCreated(function onCreated() {
this.subscribe('conversations');
});
And here is my publication:
Meteor.publish('conversations', function conversations(options = {}) {
const optionsToUse = _.pick(options, ['limit', 'skip']);
optionsToUse.sort = { date: -1 };
Meteor.publishWithRelations({
handle: this,
collection: Meteor.participants,
options: optionsToUse,
filter: { userId: this.userId, deleted: { $exists: false } },
mappings: [{
key: 'conversationId',
collection: Meteor.conversations,
mappings: [{
key: 'conversationId',
collection: Meteor.participants,
filter: { userId: { $ne: this.userId } },
reverse: true,
mappings: [{
key: 'userId',
collection: Meteor.users,
options: { fields: { username: true, avatarId: true } },
}],
}, {
reverse: true,
key: 'conversationId',
collection: Meteor.messages,
options: { limit: 1, sort: { date: -1 } },
}],
}],
});
});
And now, every time I open this template I must wait around 1 minute to load (In production, there are to much messages).
What I want? I want faster loading. I tried meteorhacks:fast-render, percolate:paginated-subscription. But It do not works for me. I want something like this: I open template, after short loading see first 10(for example) dialogs and then, when I already see some dialogs, other a loading in background. What can I do for it?