as you know reactive join is not going to work in publish, but there I have a work around that works for my app. for example in a publish like this:
`Meteor.publish('topPostsWithTopComments', function() {
var topPostsCursor = Posts.find({}, {sort: {score: -1}, limit: 30});
var userIds = topPostsCursor.map(function(p) { return p.userId });
return [
topPostCursor,
Meteor.users.find({_id: {$in: userIds}});
];
});`
if before rendering posts we check for its user and if it doesn't exist in the client we just subs.clear()
there won't be any issue with reactive join.
the only downside is each time I use subs.clear() the page blinks, I don't know how the internal of publish and subscribe works but is it possible to only update the subs without clearing it from minimongo and when the new info got to the client it will automatically get updated on the page without the blink.
as you know reactive join is not going to work in publish, but there I have a work around that works for my app. for example in a publish like this: `Meteor.publish('topPostsWithTopComments', function() { var topPostsCursor = Posts.find({}, {sort: {score: -1}, limit: 30}); var userIds = topPostsCursor.map(function(p) { return p.userId });
return [ topPostCursor, Meteor.users.find({_id: {$in: userIds}}); ]; });` if before rendering posts we check for its user and if it doesn't exist in the client we just subs.clear() there won't be any issue with reactive join.
the only downside is each time I use subs.clear() the page blinks, I don't know how the internal of publish and subscribe works but is it possible to only update the subs without clearing it from minimongo and when the new info got to the client it will automatically get updated on the page without the blink.