{"action":"opened","issue":{"url":"https://api.github.com/repos/spoike/refluxjs/issues/228","labels_url":"https://api.github.com/repos/spoike/refluxjs/issues/228/labels{/name}","comments_url":"https://api.github.com/repos/spoike/refluxjs/issues/228/comments","events_url":"https://api.github.com/repos/spoike/refluxjs/issues/228/events","html_url":"https://github.com/spoike/refluxjs/issues/228","id":56760496,"number":228,"title":"Action.triggerPromise is probaby not what you expect","user":{"login":"robcolburn","id":245860,"avatar_url":"https://avatars.githubusercontent.com/u/245860?v=3","gravatar_id":"","url":"https://api.github.com/users/robcolburn","html_url":"https://github.com/robcolburn","followers_url":"https://api.github.com/users/robcolburn/followers","following_url":"https://api.github.com/users/robcolburn/following{/other_user}","gists_url":"https://api.github.com/users/robcolburn/gists{/gist_id}","starred_url":"https://api.github.com/users/robcolburn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robcolburn/subscriptions","organizations_url":"https://api.github.com/users/robcolburn/orgs","repos_url":"https://api.github.com/users/robcolburn/repos","events_url":"https://api.github.com/users/robcolburn/events{/privacy}","received_events_url":"https://api.github.com/users/robcolburn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-06T02:11:01Z","updated_at":"2015-02-06T02:11:01Z","closed_at":null,"body":"The idea of `triggerPromise` is that you can \"trigger\" and action, and collect the promise of that action completion and result, and therefor it's result.  But, here's the rub, Actions are EVENTS.  So, you are returned a promise resolved when any trigger of the action is completed.  I've probably lost you, but let's see this play-out.\r\n\r\nLet's take a simple Reflux component layout…\r\n\r\n```jsx\r\nRefreshTransactions = {}\r\nRefreshTransactions.load = Reflux.createAction({async: true})\r\nRefreshTransactions.load.listenPromise(params => api.promise(params))\r\n\r\nTransactionStore = Reflux.createStore({\r\n  listenables: [RefreshTransactions],\r\n  data: [],\r\n  getInitalState(){\r\n    return this.data\r\n  },\r\n  onLoadCompleted(data){\r\n    this.trigger(this.data = data)\r\n  }\r\n  onLoadFailed(){\r\n    this.trigger(this.data = [])\r\n  }\r\n})\r\n\r\nTransactionView = React.createClass({\r\n  mixins: [Reflux.connect(TransactionStore, 'transactions')],\r\n  render(){\r\n    return <ul>{this.state.transactions.map(t =>\r\n      <li>{t.name} {t.amount} {t.date}</li>\r\n    }</ul>\r\n  }\r\n})\r\n\r\napp.use(function(req, res, next) {\r\n  RefreshTransactions\r\n    .triggerPromise(req.query.accountId)\r\n    .then(function(data){\r\n      TransactionStore.data = data\r\n      res.send(React.render(<TransactionView accountId={req.query.accountId} />))\r\n    })\r\n})\r\n```\r\n\r\nQuery-strings are clearly a bad idea, esp with accounts, but I'm trying to show something trivial. Here's the problem on the server, let's say three requests come in around the same time.\r\n* /transactions?accountId=1\r\n* /transactions?accountId=2\r\n* /transactions?accountId=3\r\n\r\nSo, your isomorphic app runs out to grab that data from the api.  When the first response comes in from the API… the action fulfills *all* promises.  Which means you'll end up rendering the same result for all three requests.\r\n\r\nNow, I'm not dealing with accounts and transactions, but I do want a promise of when *my* trigger is done.  You can solve this simple example in a dozen different ways, but they are likely all stepping out using Reflux.  Is there a way to do this in Reflux?"}}