{"action":"created","issue":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/757","labels_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/757/labels{/name}","comments_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/757/comments","events_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/757/events","html_url":"https://github.com/aldeed/meteor-autoform/issues/757","id":60639883,"number":757,"title":"Select options keep growing due to multiple ccalls to autoform:{options: function}","user":{"login":"ssteinerx","id":43063,"avatar_url":"https://avatars.githubusercontent.com/u/43063?v=3","gravatar_id":"","url":"https://api.github.com/users/ssteinerx","html_url":"https://github.com/ssteinerx","followers_url":"https://api.github.com/users/ssteinerx/followers","following_url":"https://api.github.com/users/ssteinerx/following{/other_user}","gists_url":"https://api.github.com/users/ssteinerx/gists{/gist_id}","starred_url":"https://api.github.com/users/ssteinerx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssteinerx/subscriptions","organizations_url":"https://api.github.com/users/ssteinerx/orgs","repos_url":"https://api.github.com/users/ssteinerx/repos","events_url":"https://api.github.com/users/ssteinerx/events{/privacy}","received_events_url":"https://api.github.com/users/ssteinerx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-11T10:45:44Z","updated_at":"2015-03-11T16:20:51Z","closed_at":null,"body":"The list just keeps growing and growing...and the console shows that the function is called multiple times.\r\nUPDATE: I just noticed that, after I put records in Clients manually with the `meteor mongo` console, they were being given ObjectID default Mongo keys and my getClientSelectOptions was returning that object as 'value.'  \r\n\r\nThis was causing an exception:\r\n  Exception from Tracker recompute function: Error: Unexpected object in htmljs in toText: \r\n\r\nIt seems that Meteor gets grumpy unless its string type keys are used.\r\n\r\nRegardless, should autoform be handling this exception somehow, or is this an upstream issue with an unfortunate side effect for autoform?\r\n\r\nGiven this in the schema:\r\n ```javascript\r\nclientId: {\r\n    type: String,\r\n    optional: false,\r\n    autoform: {\r\n      options: getClientSelectOptions\r\n    }\r\n  }\r\n```\r\nAnd this as the options function:\r\n```javascript\r\nfunction getClientSelectOptions() {\r\n  // body...\r\n  return Clients.find().map(\r\n    function (client) {\r\n      console.log(\"getClientSelectOptions-detached map clients\");\r\n      console.log(client);\r\n      return ({\r\n        label: client.companyName,\r\n        value: client._id\r\n      });\r\n    }\r\n  )\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/comments/78297853","html_url":"https://github.com/aldeed/meteor-autoform/issues/757#issuecomment-78297853","issue_url":"https://api.github.com/repos/aldeed/meteor-autoform/issues/757","id":78297853,"user":{"login":"aldeed","id":3012067,"avatar_url":"https://avatars.githubusercontent.com/u/3012067?v=3","gravatar_id":"","url":"https://api.github.com/users/aldeed","html_url":"https://github.com/aldeed","followers_url":"https://api.github.com/users/aldeed/followers","following_url":"https://api.github.com/users/aldeed/following{/other_user}","gists_url":"https://api.github.com/users/aldeed/gists{/gist_id}","starred_url":"https://api.github.com/users/aldeed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aldeed/subscriptions","organizations_url":"https://api.github.com/users/aldeed/orgs","repos_url":"https://api.github.com/users/aldeed/repos","events_url":"https://api.github.com/users/aldeed/events{/privacy}","received_events_url":"https://api.github.com/users/aldeed/received_events","type":"User","site_admin":false},"created_at":"2015-03-11T16:20:51Z","updated_at":"2015-03-11T16:20:51Z","body":"Probably an upstream issue. I don't see any problem with your code. Options and any other attribute functions are reactive so they often will be called many times as different things happen in your form. (For example, as more `Clients` are created or published to the client in your example, the options list will be automatically updated by rerunning your function.)"}}