{"action":"closed","issue":{"url":"https://api.github.com/repos/spoike/refluxjs/issues/312","labels_url":"https://api.github.com/repos/spoike/refluxjs/issues/312/labels{/name}","comments_url":"https://api.github.com/repos/spoike/refluxjs/issues/312/comments","events_url":"https://api.github.com/repos/spoike/refluxjs/issues/312/events","html_url":"https://github.com/spoike/refluxjs/issues/312","id":70720933,"number":312,"title":"Store sometimes doesn't listen to action","user":{"login":"boxstart","id":12101391,"avatar_url":"https://avatars.githubusercontent.com/u/12101391?v=3","gravatar_id":"","url":"https://api.github.com/users/boxstart","html_url":"https://github.com/boxstart","followers_url":"https://api.github.com/users/boxstart/followers","following_url":"https://api.github.com/users/boxstart/following{/other_user}","gists_url":"https://api.github.com/users/boxstart/gists{/gist_id}","starred_url":"https://api.github.com/users/boxstart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boxstart/subscriptions","organizations_url":"https://api.github.com/users/boxstart/orgs","repos_url":"https://api.github.com/users/boxstart/repos","events_url":"https://api.github.com/users/boxstart/events{/privacy}","received_events_url":"https://api.github.com/users/boxstart/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-24T15:34:21Z","updated_at":"2015-04-28T09:38:18Z","closed_at":"2015-04-28T09:38:18Z","body":"I have a Reflux store that is listening to a 'customerLoaded' action. This action supplies customer details to the store. When the store received the new or updated customer info, it is triggered to notifiy listening components of new or updated customer details.\r\nIn my actions, I have a special action to update only the email address of a customer on the server. After successful updates, the new customer details must be loaded from the server into the store. I use the regular 'loadCustomer' action for this, being called from within the 'setEmail.preEmit' action.\r\nThese are my actions:\r\n\r\n    var CustomerActions = Reflux.createActions(\r\n    [\r\n      \"loadCustomer\",\r\n      \"customerLoaded\",\r\n      \"setEmail\",\r\n    ]\r\n    );\r\n\r\n    CustomerActions.loadCustomer.preEmit = function (number)\r\n    {\r\n        if (!number|| number=== 0 || number=== '')\r\n        {\r\n            CustomerActions.customerLoaded(null);\r\n        }\r\n        else\r\n        {\r\n          // request details from server\r\n          CustomerApi.getCustomerByNumber(number)\r\n            .done(function (data)\r\n              {\r\n                  // send details to the store\r\n                  CustomerActions.customerLoaded(data);\r\n               }\r\n            );\r\n        }\r\n    };\r\n\r\n    CustomerActions.setEmail.preEmit = function (number, newValue)\r\n    {\r\n      if(number && number !== 0 && number !== '')\r\n      {\r\n        // send updated email address to server\r\n        CustomerApi.setEmail(number, newValue)\r\n          .done(function (result)\r\n          {\r\n            if(result)\r\n            {\r\n              // start action to load customer details from the server\r\n              CustomerActions.loadCustomer(number);\r\n            }\r\n            // else.. TODO: ...\r\n          });\r\n          }\r\n        };\r\n\r\nAlthough the loadCustomer action is working like it should, the store doesn't pick up the 'CustomerActions.customerLoaded' action, but only when the loadCustomer action is being called from within the 'CustomerActions.setEmail' action.\r\n\r\nI posted a question on SO, including the code for the store. http://stackoverflow.com/questions/29841570/reflux-store-is-in-one-situation-not-listening-to-an-action\r\n\r\nBy use of the developer tools in Chrome I concluded that the action is called (tested this with an 'alert' action), but that the store simply doesn't pick it up. The store isn't corrupted or whatsoever, because the listener for the 'customerLoaded' action is working fine in other situations."}}