Meteor Autorun() not running when accessing collection.property -
something strange going on; when run following code, works:
deps.autorun(function() { var room = rooms.findone({'room_id':session.get('room_id')}); // var p = room.room_id; console.log('autorun'); }
however, if uncomment var p
line, (the whole block) stops running. what's happening?
found in depths of meteor.js documentation: "if initial run of autorun throws exception, computation automatically stopped , won't rerun."
on first run of autorun, when page loaded, database hasn't been loaded throws exception when try access room.room_id
, , autorun stops running again. fixed adding:
if (room) { console.log(room.room_id); ... }
Comments
Post a Comment