After reading the latest “This Week In Meteor #3” I was keen to try out the ability to set multiple session variables at once. However, I use dot-notation in my session variable naming (perhaps wrongly!) to categorize related session variables together, so I had previously done the following (which worked):
Session.set('healthMarks.create.name', '');
Session.set('healthMarks.create.countryCode', '');
Session.set('healthMarks.create.establishmentCode', '');
After attempting the “new” way of setting them all in one go:
Session.set({
'healthMarks.create.name': '',
'healthMarks.create.countryCode': '',
'healthMarks.create.establishmentCode': ''
});
But the values remain set to their previous values. The following if
statement in the ReactiveDict.set()
code, returns false, and thus it thinks the old & new values are the same.
if (_.has(self.keys, key)) oldSerializedValue = self.keys[key];
Now I’m pretty darn sure this is an issue with using dot-notation in your session variable names, but perhaps that needs to be highlighted as a no-no in the documentation?