{"action":"created","issue":{"url":"https://api.github.com/repos/worona/meteorflux/issues/16","labels_url":"https://api.github.com/repos/worona/meteorflux/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/worona/meteorflux/issues/16/comments","events_url":"https://api.github.com/repos/worona/meteorflux/issues/16/events","html_url":"https://github.com/worona/meteorflux/issues/16","id":112369652,"number":16,"title":"AppState: autorun not cleaned up","user":{"login":"steph643","id":7039479,"avatar_url":"https://avatars.githubusercontent.com/u/7039479?v=3","gravatar_id":"","url":"https://api.github.com/users/steph643","html_url":"https://github.com/steph643","followers_url":"https://api.github.com/users/steph643/followers","following_url":"https://api.github.com/users/steph643/following{/other_user}","gists_url":"https://api.github.com/users/steph643/gists{/gist_id}","starred_url":"https://api.github.com/users/steph643/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steph643/subscriptions","organizations_url":"https://api.github.com/users/steph643/orgs","repos_url":"https://api.github.com/users/steph643/repos","events_url":"https://api.github.com/users/steph643/events{/privacy}","received_events_url":"https://api.github.com/users/steph643/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-20T13:31:58Z","updated_at":"2015-10-21T15:05:35Z","closed_at":"2015-10-21T15:05:35Z","body":"Working code:\r\n```javascript\r\nSession.set('value', 1);\r\nAppState.set('a', function() {\r\n  console.log('Function called!');\r\n  return Session.get('value');\r\n});\r\nMeteor.setTimeout(function() {\r\n  Session.set('value', 2);\r\n}, 1000);\r\n```\r\nOutput, as expected:\r\n```\r\nFunction called!\r\nFunction called!\r\n```\r\nNon-working code:\r\n```javascript\r\nSession.set('value', 1);\r\nAppState.set('a', function() {\r\n  console.log('Function called!');\r\n  return Session.get('value');\r\n});\r\nAppState.set('a', 'notAFunctionAnymore');\r\nMeteor.setTimeout(function() {\r\n  Session.set('value', 2);\r\n}, 1000);\r\n```\r\nUnexpected output:\r\n```\r\nFunction called!\r\nFunction called!\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/worona/meteorflux/issues/comments/149925771","html_url":"https://github.com/worona/meteorflux/issues/16#issuecomment-149925771","issue_url":"https://api.github.com/repos/worona/meteorflux/issues/16","id":149925771,"user":{"login":"LuisHerranz","id":3305402,"avatar_url":"https://avatars.githubusercontent.com/u/3305402?v=3","gravatar_id":"","url":"https://api.github.com/users/LuisHerranz","html_url":"https://github.com/LuisHerranz","followers_url":"https://api.github.com/users/LuisHerranz/followers","following_url":"https://api.github.com/users/LuisHerranz/following{/other_user}","gists_url":"https://api.github.com/users/LuisHerranz/gists{/gist_id}","starred_url":"https://api.github.com/users/LuisHerranz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LuisHerranz/subscriptions","organizations_url":"https://api.github.com/users/LuisHerranz/orgs","repos_url":"https://api.github.com/users/LuisHerranz/repos","events_url":"https://api.github.com/users/LuisHerranz/events{/privacy}","received_events_url":"https://api.github.com/users/LuisHerranz/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T15:05:35Z","updated_at":"2015-10-21T15:05:35Z","body":"You shouldn't be using AppState to create random computations. Use Tracker.autorun for that and you can control when to stop them."}}