【发布时间】:2014-11-06 06:50:25
【问题描述】:
从 Meteor 1.0 开始,我在 onBeforeAction 的钩子中有一个无限循环。 (create_game 被永久调用)
onBeforeAction: function(){
if(Meteor.userId()){
Meteor.call('create_game', this.params._id, 1, function(error, result){
if (error)
console.log(error);
else{
game_sus = result;
Session.set('gamesolo_id', game_sus);
}
});
}
this.next();
},
waitOn: function() { return Meteor.subscribe('game', Session.get('gamesolo_id))}
无限循环是由于会话变量引起的,如果我删除它,我不会进入循环。我不知道这是由于新版本引起的错误还是什么,但是您知道我该如何解决这个问题吗? 我尝试使用全局变量而不是会话变量,但我不使用这种方式订阅。
【问题讨论】:
标签: meteor iron-router