Helper re-call after every change?


Hey guys,
I’m having a little problem with my chat application. If a user types a message, I update a date object like this in the chat document:


_id: 123
lastType: new Date()
users: [];

My router looks like this:

Router.route('/chat/:_id', {
name: 'chat',
data: function() { return Chats.findOne(this.params._id); },
waitOn: function() { return [subs.subscribe('chat',{id:this.params._id,limit:20})]; },

To get all messages, I’m using a helper like this:{ 'messages':function() { ...some other things... return Messages.find({chat_id:this._id});} });

Now I’m getting into trouble. Every time I change the “lastType” date object of my chat, the “message()” helper executes again. Is there any possibility to disable this, when I update the Date object?


Okay, it’s all about reactivity :smiley:


data: function() { return Chats.findOne(this.params._id); }

must be

data: function() { return Chats.findOne(this.params._id, {reactive:false}); }