{"action":"created","issue":{"url":"https://api.github.com/repos/optimizely/nuclear-js/issues/140","labels_url":"https://api.github.com/repos/optimizely/nuclear-js/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/optimizely/nuclear-js/issues/140/comments","events_url":"https://api.github.com/repos/optimizely/nuclear-js/issues/140/events","html_url":"https://github.com/optimizely/nuclear-js/issues/140","id":98686642,"number":140,"title":"Change observers not called for some changes","user":{"login":"andrewdavey","id":292014,"avatar_url":"https://avatars.githubusercontent.com/u/292014?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewdavey","html_url":"https://github.com/andrewdavey","followers_url":"https://api.github.com/users/andrewdavey/followers","following_url":"https://api.github.com/users/andrewdavey/following{/other_user}","gists_url":"https://api.github.com/users/andrewdavey/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewdavey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewdavey/subscriptions","organizations_url":"https://api.github.com/users/andrewdavey/orgs","repos_url":"https://api.github.com/users/andrewdavey/repos","events_url":"https://api.github.com/users/andrewdavey/events{/privacy}","received_events_url":"https://api.github.com/users/andrewdavey/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/optimizely/nuclear-js/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-03T07:22:25Z","updated_at":"2015-08-21T10:58:51Z","closed_at":null,"body":"I've hit a very weird bug in my app. Certain orderings of changes to my store result in change observers not being called.\r\n\r\nI'm concerned that maybe I'm running into #86 \r\n\r\nI've managed to create a minimal reproduction.\r\n\r\n```js\r\nvar Nuclear = require(\"nuclear-js\"); // v1.1.1\r\n\r\nvar SET_YEAR_GROUP = \"SET_YEAR_GROUP\";\r\nvar LOADED = \"LOADED\";\r\n\r\nfunction runTest(value) {\r\n\r\n  var store = Nuclear.Store({\r\n    getInitialState: function() {\r\n      return Nuclear.toImmutable({\r\n        yearGroup: 0,\r\n        shouldLoaded: true\r\n      });\r\n    },\r\n\r\n    initialize: function() {\r\n      this.on(SET_YEAR_GROUP, setYearGroup);\r\n      this.on(LOADED, loaded);\r\n    }\r\n  });\r\n\r\n  function setYearGroup(store, payload) {\r\n    return store\r\n      .set(\"yearGroup\", payload.yearGroup)\r\n      .set(\"shouldLoad\", true);\r\n  }\r\n\r\n  function loaded(store) {\r\n    return store.set(\"shouldLoad\", false);\r\n  }\r\n\r\n  var reactor = Nuclear.Reactor();\r\n\r\n  reactor.registerStores({ uiStore: store });\r\n\r\n  var output = [];\r\n  // Record changes to yearGroup\r\n  reactor.observe([\"uiStore\", \"yearGroup\"], function(y) { output.push(y) });\r\n\r\n  reactor.dispatch(SET_YEAR_GROUP, {yearGroup: 6});\r\n  reactor.dispatch(LOADED);\r\n  reactor.dispatch(SET_YEAR_GROUP, {yearGroup: value});\r\n\r\n  return output;\r\n}\r\n\r\nvar output1 = runTest(1);\r\nconsole.log(output1); // OK - logs [ 6, 1 ]\r\n\r\nvar output5 = runTest(5);\r\nconsole.log(output5); // WRONG! Logs [ 6 ] instead of [ 6, 5 ] !\r\n\r\n// Removing the reactor.dispatch(\"LOADED\"); call seems to fix things, but why?!\r\n```\r\n\r\nIs this a bug in Nuclear?"},"comment":{"url":"https://api.github.com/repos/optimizely/nuclear-js/issues/comments/133372806","html_url":"https://github.com/optimizely/nuclear-js/issues/140#issuecomment-133372806","issue_url":"https://api.github.com/repos/optimizely/nuclear-js/issues/140","id":133372806,"user":{"login":"andrewdavey","id":292014,"avatar_url":"https://avatars.githubusercontent.com/u/292014?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewdavey","html_url":"https://github.com/andrewdavey","followers_url":"https://api.github.com/users/andrewdavey/followers","following_url":"https://api.github.com/users/andrewdavey/following{/other_user}","gists_url":"https://api.github.com/users/andrewdavey/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewdavey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewdavey/subscriptions","organizations_url":"https://api.github.com/users/andrewdavey/orgs","repos_url":"https://api.github.com/users/andrewdavey/repos","events_url":"https://api.github.com/users/andrewdavey/events{/privacy}","received_events_url":"https://api.github.com/users/andrewdavey/received_events","type":"User","site_admin":false},"created_at":"2015-08-21T10:58:50Z","updated_at":"2015-08-21T10:58:50Z","body":"Are there any work-arounds I can try? I'm nearing a release deadline and really need to have this issue resolved."}}