この例でレンダリングされたライブ HTML がクリアされ続け、無限ループで再描画される理由を誰か教えてもらえますか? このコード例は、私のラップトップの CPU を使い果たします..
環境:
- メテオ 0.3.7
- Mac OS ライオン
- Safari 5.1.7、Chrome Canary 22.0.1189、Chrome 21.0.1180、Firefox 11.0 & 13.0 でテスト済み
最初のプロジェクトの作成:
meteor create test
cd test
meteor add coffeescript
mv test.js test.coffee
meteor
test.coffee:
Records = new Meteor.Collection("records")
if Meteor.is_client
Template.table.records = ->
Records.find()
Template.table.rowCount = ->
Records.find().count()
if Meteor.is_server
Meteor.startup ->
if Records.find().count() is 0
for i in [1..1000]
Records.insert({some:"test", data: "just", to: "check"})
test.html:
<head>
<title>test</title>
</head>
<body>
{{> table}}
</body>
<template name="table">
<table>
<caption>{{rowCount}}</caption>
{{#each records}}
<tr>
<td>{{some}}</td>
<td>{{data}}</td>
<td>{{to}}</td>
</tr>
{{/each}}
</table>
</template>