diff --git a/packages/livedata/livedata_server.js b/packages/livedata/livedata_server.js index d89679bfa8..fc625a39e9 100644 --- a/packages/livedata/livedata_server.js +++ b/packages/livedata/livedata_server.js @@ -195,7 +195,7 @@ _.extend(Meteor._SessionCollectionView.prototype, { var clearedResult = []; var docView = self.documents[id]; if (!docView) - throw new Error("Could not find element with id " + id + "to change"); + throw new Error("Could not find element with id " + id + " to change"); _.each(changed, function (value, key) { docView.changeField(subscriptionId, key, value, changedResult); }); @@ -671,15 +671,21 @@ _.extend(Meteor._LivedataSession.prototype, { // all subscriptions _setUserId: function(userId) { var self = this; - self.userId = userId; self._isSending = false; - var beforeCVs = self.collectionViews; - self.collectionViews = {}; + self._eachSub(function (sub) { sub._resetSubscription(); + }); + + var beforeCVs = self.collectionViews; + self.collectionViews = {}; + self.userId = userId; + + self._eachSub(function (sub) { sub.userId = self.userId; sub._runHandler(); }); + self._isSending = true; self._diffCollectionViews(beforeCVs);