Hello everyone,
In the process of accommodating for external errors, I have run into some issues on how my template is being rendered. Currently I have a list of clients:
{{#if Template.subscriptionsReady}}
{{#each clients}}
{{> Template.dynamic template="Client" data=this}}
{{/each}}
{{else}}
Each client can be removed from my database on the UI. Before handling errors, my code looked like:
'click #removeClient': function(event, template) {
if (condition) {
Meteor.call('removeClientFromPermissionsFileById', this._id);
}
Meteor.call('removeClientFromDatabase', this._id);
}
This simply removed the client. No questions asked.
With my current code (below), I accommodate for external errors. I decided to wait for the callback before removing the client from my database.
'click #removeClient': function(event, template) {
if (condition) {
template.isDeletingVar.set(true);
Meteor.call('removeClientFromPermissionsFileById', this._id, function(error, result) {
if (!error) {
Meteor.call('removeClientFromDatabase', this._id);
}
// Template should not display client at this point
});
} else {
Meteor.call('removeClientFromDatabase', this._id);
}
}
However, once a client is removed from my database, the client does not disappear. If anyone has any insight as to what I am doing wrong or why the template is not re-rendering it would be greatly appreciated. Thanks so much!