meteor - Multiple startups on client -


we're seeing strange meteor behavior. after simple event hook executed (which gathers info form, executes insert , updates session variable), client seems startup again, redrawing entire page. in effect, meteor.startup being executed more once, though browser window not being refreshed (or that). stranger fact we've made extremely similar apps, don't display behavior @ all. cannot detect significant differences between different projects.

we're using meteor version 0.6.4.1 (in cases), both autopublish , insecure have been removed.

playlist.html:

<body> {{> addsong}} {{> playlist}} </body>  <template name="addsong"> <form>     <fieldset>         <legend>add song playlist!</legend>         <div><input type="text" id="artist" /></div>         <div><input type="text" id="title" /></div>         <div><button type="submit" id="insertbutton">insert</button></div>     </fieldset> </form> </template>  <template name="playlist"> <div>votes left: {{votes}}</div> <ul>     {{#each songs}}         <li>     {{artist}} - {{title}} - {{score}}     <button class="voteup" mongo_id="{{_id}}">vote up!</button>     <button class="remove" mongo_id="{{_id}}">x</button> </li>     {{/each}} </ul> </template> 

lib/common.coffee

@songs = new meteor.collection "songs"  songs.allow     insert: (userid) ->             true     update: (userid) ->             true     remove: (userid) ->             true 

client/client.coffee

meteor.subscribe "songs"  template.playlist.songs = ->   songs.find {},{sort:{"score":-1}}  template.playlist.votes = -> session.get("votes")  template.addsong.events   'click #insertbutton': (event,template) ->     artist = template.find("#artist").value     title = template.find("#title").value     songs.insert({"artist":artist,"title":title,"score":1})     votes = session.get("votes")     session.set "votes", votes+3     return  template.playlist.events     'click .voteup': (event,template) ->         id = event.target.attributes.mongo_id.value         songs.update({_id:id},{$inc:{"score":1}})     'click .remove': (event,template) ->         id = event.target.attributes.mongo_id.value         songs.remove({_id:id})  meteor.startup ->     alert "starting"     session.setdefault "votes", 0 

server/server.coffee

meteor.publish "songs", -> songs.find({}) 

to replicate weird behavior, submit items on form, triggers startup every time (verified in chrome safari).

if have code on github, can @ it, description, it's hard problem be...


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -