流星模板助手反应性不一致

Meteor Template Helper Reactivity inconsistency

我有一个模板助手,用于显示具有反应性变量 schoolFindQuery 的学校

    Template.schoolCompareCenterList.helpers({
  schools(){
    console.log("schoolFindQuery is :" + schoolFindQuery);
      let school =  Schools.find(JSON.parse(schoolFindQuery), {limit : 20});
      console.log("school count is : " + school.count());

        return school;
}
})

和 schoolFindQuery 反应变量随着按钮点击而变化,随着按钮点击订阅被更新并且 ui 正在相应地改变。奇怪的是,当订阅 return 数据时没有问题,但只要订阅 return 有任何数据,之后 Helper 代码将不会随着订阅更改而重新运行(即使我可以看到流星玩具的订阅)和ui 没有显示任何数据。 我的订阅码在下面,

this.autorun(function() {


if(subscription)
  subscription.stop()


//This reactive variables set by buttons and by the ghelp of reactivty subscription rerun
    query = "{"
    if(_sTy__.get() != 0 && _sTy__ != null)
      query += "\"schoolType.schoolT\" : \"" +  _sTy__.get()+ "\","
    if (_sTy2__.get() != 0 && _sTy2__ != null)
      query += "\"schoolType.schoolTT\" : \""+  _sTy2__.get() +"\","
    if(regexSchoolName.get() != 0 && regexSchoolName.get() != null )
      query += "\"schoolName\" : {\"$regex\": \".*" + regexSchoolName.get() + ".*\", \"$options\": \"i\"},"

    query += "\"haveSchoolDetailInfo\" : true}"

    subscription = Meteor.subscribe("schoolCompare.infinite.publish", query,  20, 0);
    schoolFindQuery = query;})

提前致谢。

我建议你看看这个教程,它解释了 Session 变量、Reactive Dict 和 Reactive Var:https://blog.meteor.com/the-meteor-chef-reactive-dict-reactive-vars-and-session-variables-971584515a27#.undr5c1f0