{"action":"created","issue":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/403","labels_url":"https://api.github.com/repos/lhorie/mithril.js/issues/403/labels{/name}","comments_url":"https://api.github.com/repos/lhorie/mithril.js/issues/403/comments","events_url":"https://api.github.com/repos/lhorie/mithril.js/issues/403/events","html_url":"https://github.com/lhorie/mithril.js/issues/403","id":53612867,"number":403,"title":"Pass ajax result through future chain","user":{"login":"ilog2000","id":4150856,"avatar_url":"https://avatars.githubusercontent.com/u/4150856?v=3","gravatar_id":"","url":"https://api.github.com/users/ilog2000","html_url":"https://github.com/ilog2000","followers_url":"https://api.github.com/users/ilog2000/followers","following_url":"https://api.github.com/users/ilog2000/following{/other_user}","gists_url":"https://api.github.com/users/ilog2000/gists{/gist_id}","starred_url":"https://api.github.com/users/ilog2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ilog2000/subscriptions","organizations_url":"https://api.github.com/users/ilog2000/orgs","repos_url":"https://api.github.com/users/ilog2000/repos","events_url":"https://api.github.com/users/ilog2000/events{/privacy}","received_events_url":"https://api.github.com/users/ilog2000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-07T09:25:41Z","updated_at":"2015-01-07T10:08:15Z","closed_at":null,"body":"Right now this code doesn't work (although was expected, at least by me)\r\n```javascript\r\nvar users = m.prop([]); //default value\r\nvar log = function(data) {\r\n    console.log(JSON.stringify(data))\r\n}\r\nm.request({method: \"GET\", url: \"/user\"}).then(log).then(users)\r\n```\r\nIt would be good if ajax result is passed through the future chain."},"comment":{"url":"https://api.github.com/repos/lhorie/mithril.js/issues/comments/69001716","html_url":"https://github.com/lhorie/mithril.js/issues/403#issuecomment-69001716","issue_url":"https://api.github.com/repos/lhorie/mithril.js/issues/403","id":69001716,"user":{"login":"barneycarroll","id":83627,"avatar_url":"https://avatars.githubusercontent.com/u/83627?v=3","gravatar_id":"","url":"https://api.github.com/users/barneycarroll","html_url":"https://github.com/barneycarroll","followers_url":"https://api.github.com/users/barneycarroll/followers","following_url":"https://api.github.com/users/barneycarroll/following{/other_user}","gists_url":"https://api.github.com/users/barneycarroll/gists{/gist_id}","starred_url":"https://api.github.com/users/barneycarroll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barneycarroll/subscriptions","organizations_url":"https://api.github.com/users/barneycarroll/orgs","repos_url":"https://api.github.com/users/barneycarroll/repos","events_url":"https://api.github.com/users/barneycarroll/events{/privacy}","received_events_url":"https://api.github.com/users/barneycarroll/received_events","type":"User","site_admin":false},"created_at":"2015-01-07T10:08:15Z","updated_at":"2015-01-07T10:08:15Z","body":"Each `then` consumes the return value of the last function in the chain. Because `log` has no explicit return value, it outputs `undefined`, which is then received by `users`. You can fix this by making `log` return its input, [as shown here](http://jsfiddle.net/barney/c63dp1vk/). This allows you to modify or replace values with `then`, which is useful if you want to modify values before assigning them ([example here](http://j(casting-the-response-data-to-a-class))."}}