{"action":"created","issue":{"url":"https://api.github.com/repos/acdlite/flummox/issues/23","labels_url":"https://api.github.com/repos/acdlite/flummox/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/acdlite/flummox/issues/23/comments","events_url":"https://api.github.com/repos/acdlite/flummox/issues/23/events","html_url":"https://github.com/acdlite/flummox/issues/23","id":57588354,"number":23,"title":"Access stores within action ","user":{"login":"vesparny","id":82070,"avatar_url":"https://avatars.githubusercontent.com/u/82070?v=3","gravatar_id":"","url":"https://api.github.com/users/vesparny","html_url":"https://github.com/vesparny","followers_url":"https://api.github.com/users/vesparny/followers","following_url":"https://api.github.com/users/vesparny/following{/other_user}","gists_url":"https://api.github.com/users/vesparny/gists{/gist_id}","starred_url":"https://api.github.com/users/vesparny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vesparny/subscriptions","organizations_url":"https://api.github.com/users/vesparny/orgs","repos_url":"https://api.github.com/users/vesparny/repos","events_url":"https://api.github.com/users/vesparny/events{/privacy}","received_events_url":"https://api.github.com/users/vesparny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-02-13T11:30:02Z","updated_at":"2015-02-13T15:46:38Z","closed_at":null,"body":"I need to check Store's state within an action for caching purpose.\r\nIn the action I need to check if the store already contains data, otherwise I'll call my ApiUtils.\r\n\r\nIs there a way to have Store access within Actions?"},"comment":{"url":"https://api.github.com/repos/acdlite/flummox/issues/comments/74273912","html_url":"https://github.com/acdlite/flummox/issues/23#issuecomment-74273912","issue_url":"https://api.github.com/repos/acdlite/flummox/issues/23","id":74273912,"user":{"login":"vesparny","id":82070,"avatar_url":"https://avatars.githubusercontent.com/u/82070?v=3","gravatar_id":"","url":"https://api.github.com/users/vesparny","html_url":"https://github.com/vesparny","followers_url":"https://api.github.com/users/vesparny/followers","following_url":"https://api.github.com/users/vesparny/following{/other_user}","gists_url":"https://api.github.com/users/vesparny/gists{/gist_id}","starred_url":"https://api.github.com/users/vesparny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vesparny/subscriptions","organizations_url":"https://api.github.com/users/vesparny/orgs","repos_url":"https://api.github.com/users/vesparny/repos","events_url":"https://api.github.com/users/vesparny/events{/privacy}","received_events_url":"https://api.github.com/users/vesparny/received_events","type":"User","site_admin":false},"created_at":"2015-02-13T15:46:38Z","updated_at":"2015-02-13T15:46:38Z","body":"Just tried, this is my store\r\n\r\n```javascript\r\nclass MyStore extends Store {\r\n  constructor(flux) {\r\n    super();\r\n    var searchActionIds = flux.getActionIds('search');\r\n    this.registerAsync(searchActionIds.search, this.handleSearchBefore, this.handleSearchSuccess, this.handleSearchError );\r\n    this.state = {\r\n      data:  []\r\n    };\r\n  }\r\n  handleSearchSuccess(result) {\r\n    this.flux.getActions('requests').endRequest();\r\n    this.setState({\r\n      data: result\r\n    });\r\n  }\r\n  handleSearchBefore() {\r\n   // Need to fire this action because I use a prop on the component to show/hide a spinner\r\n    this.flux.getActions('requests').startRequest();\r\n  }\r\n  handleSearchError(err) {\r\n    console.log(err);\r\n  }\r\n}\r\n```\r\n\r\nI got an error coming from the FB dispatcher:\r\n```\r\nError: Invariant Violation: Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.\r\n```\r\nMaybe this will clarify a bit more my issue.\r\nI'm pretty sure I'm making some conception mistake here.\r\nProbably because I was used to do something like this with fluxible stack:\r\nhttps://github.com/vesparny/morpheus/blob/develop/shared/actions/ContentActions.js#L24"}}