Meteor Deps重新计算失败

时间:2013-06-04 12:01:53

标签: meteor

单击上一个按钮将检索上一个日期的集合。例如,如果当前日期是2013-04-05,那么上一个按钮将检索2013-04-04的所有集合,依此类推。但是,自动更新不起作用。新的事件集合从未出现,并且发生异常。

此外,如果我尝试创建新事件,我也会遇到此错误。只有刷新页面才能看到集合中的新事件。

错误

Exception from Deps recompute: Error: Error copying attribute ',': Error:     InvalidCharacterError: DOM Exception 5
at Function.Spark._Patcher._copyAttributes (http://0.0.0.0:3000/packages/spark/patch.js?   e76412b922e47b6c2c1f890e3bc10fd13bdecfef:494:19)
at Spark._Patcher.match (http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:249:26)
at http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:61:23
at visitNodes (http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:17:11)
at Object.Spark._patch (http://0.0.0.0:3000/packages/spark/patch.js?e76412b922e47b6c2c1f890e3bc10fd13bdecfef:31:3)
at http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:638:13
at LiveRange.operate (http://0.0.0.0:3000/packages/liverange/liverange.js?5e6bc5ba11645802c3440658c75fcc2277537dd1:458:9)
at http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:633:11
at withEventGuard (http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:103:16)
at Object.Spark.renderToRange (http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:632:3) logging.js:40

Exception from Deps afterFlush function: TypeError: Cannot read property 'previousSibling' of null
at findPosition (http://0.0.0.0:3000/packages/liverange/liverange.js?5e6bc5ba11645802c3440658c75fcc2277537dd1:177:12)
at new LiveRange (http://0.0.0.0:3000/packages/liverange/liverange.js?5e6bc5ba11645802c3440658c75fcc2277537dd1:126:18)
at notifyWatchers (http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:86:19)
at http://0.0.0.0:3000/packages/spark/spark.js?4af332696fb84f1c71f2e678ad0a267755b2b828:404:5
at _.extend.flush (http://0.0.0.0:3000/packages/deps/deps.js?651e87591167f4286e96438ff2566ba3357bff99:231:11) 

查找事件列表的代码,else下的代码是相关部分

Template.event_manager.list = () ->
   if (Session.get("events_toggl"))
     Events.find({user_id: Meteor.userId()}, {sort: {seconds: 1}})
   else
     d = Session.get("eventnav")
     start = moment().subtract("days",d).startOf("day")._d
     end = moment().subtract("days", d).endOf("end")._d
     Events.find({user_id: Meteor.userId(), date: {$gte: start, $lt: end} })

单击上一步将触发上面列表函数

中的更新
'click #previous' : () ->
    d = Session.get("eventnav")
    d += 1
    Session.set("eventnav", d)

我们决定呈现事件列表的部分

  {{#each list}}
    {{> event}}
  {{/each}}

个别事件的模板

<template name="event">
  <tr class={{status}}>
    <td>{{seconds}}</td>
    <td><p id="date-{{_id}}" class="date">{{date}}</p></td>
    <td><p id="name-{{_id}}" class="name">{{name}}</p></td>
    <td><input type="button" id="select" value="select" /><br /><br /><input type="button" id="destroy" value="delete" /></td>
  </tr>
 </template>

3 个答案:

答案 0 :(得分:2)

我遇到了同样的错误,它只是具有相同值的多个ID。

http://www.meteorpedia.com/read/TypeError_-_Cannot_read_property_nodeName_of_null

答案 1 :(得分:1)

解决了我的问题。事实证明,错误与无效的HTML按钮有关。

<input type="button", id="previous", value="previous" />
<input type="button", id="next", value="forward" />

简单的解决方法是消除所有逗号。

答案 2 :(得分:0)

我没有重复的ID,但删除列表元素的id属性解决了这个问题:

错误的HTML:

  {{#each formDatas}}
  <tr class="formDataRow" id="{{_id}}">
     {{#each ../this}}
     <td>{{getData ../this this }}</td>
     {{/each}}
     <td><input id="{{_id}}" class="row-selector" type="checkbox"></td>
  </tr>
  {{/each}}

不会导致错误的HTML

  {{#each formDatas}}
  <tr class="formDataRow" id="{{_id}}">
     {{#each ../this}}
     <td>{{getData ../this this }}</td>
     {{/each}}
     <td><input class="row-selector" type="checkbox"></td>
  </tr>
  {{/each}}

注意id

中缺少的input属性

您通常不需要id属性,因为事件中的this对象引用了循环的数据元素