javascript - Meteor Method Endlessly Runs -


i have code in meteor.methods definition:

update_field: function(collection,document_id,field,value) {     obj = {};     obj[field] = value;     console.log(obj);     if (collection == 'clients') {         var collection = clients;        } else if(collection = 'sites') {         var collection = sites;     }     collection.update(     {         _id: document_id     }, {         $set: obj     }, function(error,id) {         console.log(error,id);         return(error,id);     }     ); } 

this method called several client-side helpers events, , updates field needed. whenever runs once, never stops running. runs infinitely when meteor.call('update_field')s have been commented out. have tried including 'caller' parameter , adding possible calls figure out why keeps getting called no avail. ideas why looping?

edit: runs 2,000/minute

edit2: called in 1 of 2 ways: on keyup code==13 (enter) in appropriate field or field blur. however, event when these calls commented out, issue persists.

especially second comment worries me:

however, when these calls commented out, issue persists.

then calling it? behaviour you're describing points helper executing method. method changes data, re-executes helper (reactivity) , end classic endless loop.

check entire source code references method:

$ grep -r "update_field" * 

maybe set variable somehow , use variable call method. also: have declared method inside meteor.methods({ ... }) block?


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -