Skip to content

Commit

Permalink
Fix for Meteor 1.3
Browse files Browse the repository at this point in the history
On Meteor 1.3 data gets removed from the publication on stop.  This will prevent it from calling the remove document when this subscription stops so
the data if it is being used by another publication is still present on the client.

Fixes versolearning#7
  • Loading branch information
trajano committed Apr 5, 2016
1 parent 9b4386d commit d24b307
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions find-from-publication.js
Expand Up @@ -38,6 +38,23 @@ if (Meteor.isServer) {
oldRemoved(collection, id);
};

// On Meteor 1.3 data gets removed from the publication on stop. This will
// prevent it from calling the remove document when this subscription stops so
// the data if it is being used by another publication is still present on the
// client.
this.onStop(function () {
this.removed = function (collection, id) {
// the only way this can get called is when all documents are removed
// from the subscription as it's torn down, we know that the underlying document
// will also be removed, and this will pick it up.
if (collection === METADATA_COLLECTION) {
return;
}
oldRemoved(METADATA_COLLECTION, constructId(collection, name, id));
};
});


return fn.apply(this, arguments);
});
};
Expand Down

0 comments on commit d24b307

Please sign in to comment.