{"action":"created","issue":{"url":"https://api.github.com/repos/graphql/graphql-js/issues/17","labels_url":"https://api.github.com/repos/graphql/graphql-js/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/graphql/graphql-js/issues/17/comments","events_url":"https://api.github.com/repos/graphql/graphql-js/issues/17/events","html_url":"https://github.com/graphql/graphql-js/issues/17","id":92904864,"number":17,"title":"Broken promise behaviour when types used in list have async field resolve functions.","user":{"login":"latentflip","id":78225,"avatar_url":"https://avatars.githubusercontent.com/u/78225?v=3","gravatar_id":"","url":"https://api.github.com/users/latentflip","html_url":"https://github.com/latentflip","followers_url":"https://api.github.com/users/latentflip/followers","following_url":"https://api.github.com/users/latentflip/following{/other_user}","gists_url":"https://api.github.com/users/latentflip/gists{/gist_id}","starred_url":"https://api.github.com/users/latentflip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/latentflip/subscriptions","organizations_url":"https://api.github.com/users/latentflip/orgs","repos_url":"https://api.github.com/users/latentflip/repos","events_url":"https://api.github.com/users/latentflip/events{/privacy}","received_events_url":"https://api.github.com/users/latentflip/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-03T16:24:33Z","updated_at":"2015-07-04T23:31:07Z","closed_at":"2015-07-04T23:29:23Z","body":"Okay, I'm still digging into this, and trying to simplify my examples, but it looks like something funky is going on with field resolve behaviour when promises are returned.\r\n\r\nHere's example code which demonstrates the behaviour (as well as the results) https://gist.github.com/latentflip/f1c9520ac0d83b5237fc note how in the results, projectPromises differs from projectResults.\r\n\r\nOkay, to explain further, the basic setup I have is:\r\n\r\n```\r\ntype Org {\r\n  id: String\r\n  projects: [Project]\r\n}\r\n\r\ntype Project {\r\n  id: String\r\n  versions: ProjectVersion\r\n}\r\n\r\ntype ProjectVersion {\r\n  id: String\r\n}\r\n```\r\n\r\nand my root query just returns one org, so the query I'm executing is:\r\n\r\n```\r\nquery Foo {\r\n  org {\r\n    id,\r\n    projects {\r\n      versions\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nwhich should return the org, all it's projects, and all their versions.\r\n\r\nHowever, it seems if my `projects.versions` resolve function returns a promise, instead of immediately returning an array, something breaks. To demonstrate, in the actual code linked above, I've got a ProjectReturnType which just [returns an array for it's versions](https://gist.github.com/latentflip/f1c9520ac0d83b5237fc#file-input-js-L25-L30) and a ProjectPromiseType which [returns the same array, but wrapped in a `Promise.resolve()`](https://gist.github.com/latentflip/f1c9520ac0d83b5237fc#file-input-js-L47-L53). The latter seems to break the `projectPromises` in the response completely, and it just returns `{}`.\r\n\r\nAs I understand it, a resolve function returning a value, or a resolve function returning a promise of that same value, should be exactly equivalent, right?"},"comment":{"url":"https://api.github.com/repos/graphql/graphql-js/issues/comments/118562957","html_url":"https://github.com/graphql/graphql-js/issues/17#issuecomment-118562957","issue_url":"https://api.github.com/repos/graphql/graphql-js/issues/17","id":118562957,"user":{"login":"leebyron","id":50130,"avatar_url":"https://avatars.githubusercontent.com/u/50130?v=3","gravatar_id":"","url":"https://api.github.com/users/leebyron","html_url":"https://github.com/leebyron","followers_url":"https://api.github.com/users/leebyron/followers","following_url":"https://api.github.com/users/leebyron/following{/other_user}","gists_url":"https://api.github.com/users/leebyron/gists{/gist_id}","starred_url":"https://api.github.com/users/leebyron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leebyron/subscriptions","organizations_url":"https://api.github.com/users/leebyron/orgs","repos_url":"https://api.github.com/users/leebyron/repos","events_url":"https://api.github.com/users/leebyron/events{/privacy}","received_events_url":"https://api.github.com/users/leebyron/received_events","type":"User","site_admin":false},"created_at":"2015-07-04T23:31:07Z","updated_at":"2015-07-04T23:31:07Z","body":"@latentflip please check out 0fd8be16abd3fb14bcc97b933f68b99582af9403 and let me know if the test cases I added are aligning with the issues you ran into."}}