{"action":"created","issue":{"url":"https://api.github.com/repos/goatslacker/alt/issues/71","labels_url":"https://api.github.com/repos/goatslacker/alt/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/goatslacker/alt/issues/71/comments","events_url":"https://api.github.com/repos/goatslacker/alt/issues/71/events","html_url":"https://github.com/goatslacker/alt/issues/71","id":60746743,"number":71,"title":"Cannot dispatch in the middle of a dispatch","user":{"login":"jongbeau","id":2096970,"avatar_url":"https://avatars.githubusercontent.com/u/2096970?v=3","gravatar_id":"","url":"https://api.github.com/users/jongbeau","html_url":"https://github.com/jongbeau","followers_url":"https://api.github.com/users/jongbeau/followers","following_url":"https://api.github.com/users/jongbeau/following{/other_user}","gists_url":"https://api.github.com/users/jongbeau/gists{/gist_id}","starred_url":"https://api.github.com/users/jongbeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jongbeau/subscriptions","organizations_url":"https://api.github.com/users/jongbeau/orgs","repos_url":"https://api.github.com/users/jongbeau/repos","events_url":"https://api.github.com/users/jongbeau/events{/privacy}","received_events_url":"https://api.github.com/users/jongbeau/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-11T23:23:11Z","updated_at":"2015-04-08T14:32:22Z","closed_at":"2015-03-20T20:18:56Z","body":"From a Login react component, I have a login action that makes an API request and on successful response, it updates a SessionStore. The Login component sees the value of the session store updated through it's props passed down from the parent component, and in shouldComponentUpdate, it does a transitionTo (using react-router) to an account page. The account page then calls an action to update the SessionStore in ComponentWillMount.\r\n\r\nI'm getting this error message:\r\nUncaught Error: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.\r\n\r\nI believe it's due to the account page trying to update the SessionStore as the result of the SessionStore just getting updated from a previous action. Any suggestions on how to architect this differently?\r\n\r\nNOTE: things work when using react-router's HashLocation, but not with the HistoryLocation."},"comment":{"url":"https://api.github.com/repos/goatslacker/alt/issues/comments/90933884","html_url":"https://github.com/goatslacker/alt/issues/71#issuecomment-90933884","issue_url":"https://api.github.com/repos/goatslacker/alt/issues/71","id":90933884,"user":{"login":"deser","id":3010698,"avatar_url":"https://avatars.githubusercontent.com/u/3010698?v=3","gravatar_id":"","url":"https://api.github.com/users/deser","html_url":"https://github.com/deser","followers_url":"https://api.github.com/users/deser/followers","following_url":"https://api.github.com/users/deser/following{/other_user}","gists_url":"https://api.github.com/users/deser/gists{/gist_id}","starred_url":"https://api.github.com/users/deser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deser/subscriptions","organizations_url":"https://api.github.com/users/deser/orgs","repos_url":"https://api.github.com/users/deser/repos","events_url":"https://api.github.com/users/deser/events{/privacy}","received_events_url":"https://api.github.com/users/deser/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T14:32:22Z","updated_at":"2015-04-08T14:32:22Z","body":"Guys from facebook say that this solution not bad: https://monosnap.com/image/VfYSlclKucvgSkudGJnliEkn19upZu\r\n\r\nP.S. setTimeout is not silver bulletin. I can't use setTimeout elsewhere\r\n"}}