I have two collections: users
and tradeOffers
. Each user
has a unique steamid
field. Each tradeOffer
has field recipient.steamid
. On server I publish tradeOffers
collection like this:
import { Meteor } from 'meteor/meteor';
import { TradeOffers } from './collection';
if (Meteor.isServer) {
Meteor.publish("tradeOffers", function () {
let user = Meteor.users.findOne({_id: this.userId });
return TradeOffers.find({
'recipient.steamid': user.services.steam.steamid
});
});
}
On client side I subscribe to this collection and display current user’s trade offers. Everything works fine until I update the user. Whenever current user is updated, data disappears from the view. After page reload I can see trade offers again. Any help would be appreciated.