Remove some subscription / reactivity / caching bugs and the unnecessary PatientLocations collection

This commit is contained in:
Erik Ziegler committed 2016-02-10 16:38:49 +01:00
1 parent 7d42456f57
commit 9cde04bcfe
43 files changed
+321 -234

No files matched your search

+68
View File
@@ -0,0 +1,68 @@
Meteor.startup(function() {
var debug = false;
if (debug === true) {
// http://www.meteorpedia.com/read/Debugging_Reactivity
Meteor.autorun(function(computation) {
computation.onInvalidate(function() {
console.trace();
});
});
var wrappedFind = Meteor.Collection.prototype.find;
Meteor.Collection.prototype.find = function() {
var cursor = wrappedFind.apply(this, arguments);
var collectionName = this._name || this._debugName;
/*cursor.observeChanges({
added: function(id, fields) {
console.log(collectionName, 'added', id, fields);
},
changed: function(id, fields) {
console.log(collectionName, 'changed', id, fields);
},
movedBefore: function(id, before) {
console.log(collectionName, 'movedBefore', id, before);
},
removed: function(id) {
console.log(collectionName, 'removed', id);
}
});*/
cursor.observe({
added: function(data) {
console.log(collectionName, 'added', data);
},
changed: function(data) {
console.log(collectionName, 'changed', data);
},
removed: function(data) {
console.log(collectionName, 'removed', data);
}
});
return cursor;
};
function logRenders() {
Object.keys(Template).forEach(function(name) {
if (name.indexOf('_') > -1) {
return;
}
var template = Template[name];
var oldRender = template.rendered;
var counter = 0;
template.rendered = function() {
console.log(name, 'render count: ', ++counter);
oldRender && oldRender.apply(this, arguments);
};
});
}
logRenders();
}
});