{"action":"created","issue":{"url":"https://api.github.com/repos/toranb/ember-redux/issues/7","repository_url":"https://api.github.com/repos/toranb/ember-redux","labels_url":"https://api.github.com/repos/toranb/ember-redux/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/toranb/ember-redux/issues/7/comments","events_url":"https://api.github.com/repos/toranb/ember-redux/issues/7/events","html_url":"https://github.com/toranb/ember-redux/pull/7","id":147176947,"number":7,"title":"[FEATURE]: return dispatch value to allow model hook to wait for thunk promises","user":{"login":"brettburley","id":8064362,"avatar_url":"https://avatars.githubusercontent.com/u/8064362?v=3","gravatar_id":"","url":"https://api.github.com/users/brettburley","html_url":"https://github.com/brettburley","followers_url":"https://api.github.com/users/brettburley/followers","following_url":"https://api.github.com/users/brettburley/following{/other_user}","gists_url":"https://api.github.com/users/brettburley/gists{/gist_id}","starred_url":"https://api.github.com/users/brettburley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettburley/subscriptions","organizations_url":"https://api.github.com/users/brettburley/orgs","repos_url":"https://api.github.com/users/brettburley/repos","events_url":"https://api.github.com/users/brettburley/events{/privacy}","received_events_url":"https://api.github.com/users/brettburley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-09T23:48:43Z","updated_at":"2016-04-10T21:58:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/toranb/ember-redux/pulls/7","html_url":"https://github.com/toranb/ember-redux/pull/7","diff_url":"https://github.com/toranb/ember-redux/pull/7.diff","patch_url":"https://github.com/toranb/ember-redux/pull/7.patch"},"body":"When calling an action that returns a promise (ala redux-thunk), we must return that promise from the dispatch action so that we can use it in a model hook to take advantage of the Ember model loading hooks.\r\n\r\nhttps://github.com/toranb/ember-redux/issues/5"},"comment":{"url":"https://api.github.com/repos/toranb/ember-redux/issues/comments/208081872","html_url":"https://github.com/toranb/ember-redux/pull/7#issuecomment-208081872","issue_url":"https://api.github.com/repos/toranb/ember-redux/issues/7","id":208081872,"user":{"login":"brettburley","id":8064362,"avatar_url":"https://avatars.githubusercontent.com/u/8064362?v=3","gravatar_id":"","url":"https://api.github.com/users/brettburley","html_url":"https://github.com/brettburley","followers_url":"https://api.github.com/users/brettburley/followers","following_url":"https://api.github.com/users/brettburley/following{/other_user}","gists_url":"https://api.github.com/users/brettburley/gists{/gist_id}","starred_url":"https://api.github.com/users/brettburley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brettburley/subscriptions","organizations_url":"https://api.github.com/users/brettburley/orgs","repos_url":"https://api.github.com/users/brettburley/repos","events_url":"https://api.github.com/users/brettburley/events{/privacy}","received_events_url":"https://api.github.com/users/brettburley/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T21:58:56Z","updated_at":"2016-04-10T21:58:56Z","body":"Moved this route into the actual dummy app.\r\n\r\nI did, however, keep the `loading` action in the route. This is invoked by Ember automatically when the route goes into a loading state, and I think it's important to catch this in this particular case. This is the part of the test that fails when the service's `dispatch` method *doesn't* return the promise. So by verifying that the loading state is invoked, we can be sure that we're properly returning a promise by the `dispatch` in the route's `model` hook.\r\n\r\nI was unable to find a better way to determine if the route goes into a loading state... it's tough to catch in the acceptance test itself since any `andThen`s will wait for all promises to resolve (and therefore missing the loading substate completely)."}}