Hi, I have some (simplified sample) code like below
Template.modalSelect.onCreated(function(){
var self=this;
self.data.modalHelper = {};
self.data.modalHelper.someStatus = new ReactiveVar("notsubmitted");
});
and then an event handler like so:
Template.modalSelect.events({
'click #someButton': function(e, t) {
self.modalHelper.someStatus.set('completed');
}
});
The variables all work properly, as intended the first time around, when the user signs in for the first time & access the page.
However, after (a) any event which uses the functionality (e.g. a button click triggering the event), or even (b) a browser page refresh, the onCreated variable ‘self.data.modalHelper’ disappears (self.data still exists).
If the user signs in and out (or I restart the server) it works properly again, for 1 time.
What could be the cause of this? Is there something wrong in how I am using onCreated?
Thanks for your help.
**Edit: One possible issue I think could be happening is overlapping context – ie the parent context being refreshed some how and removing the child’s context. How can I isolate data contexts of child templates in that case?