{"action":"opened","issue":{"url":"https://api.github.com/repos/apollostack/apollo-client/issues/598","repository_url":"https://api.github.com/repos/apollostack/apollo-client","labels_url":"https://api.github.com/repos/apollostack/apollo-client/issues/598/labels{/name}","comments_url":"https://api.github.com/repos/apollostack/apollo-client/issues/598/comments","events_url":"https://api.github.com/repos/apollostack/apollo-client/issues/598/events","html_url":"https://github.com/apollostack/apollo-client/issues/598","id":173882372,"number":598,"title":"Issue with using fragment multiple times with query batching","user":{"login":"dahjelle","id":156557,"avatar_url":"https://avatars.githubusercontent.com/u/156557?v=3","gravatar_id":"","url":"https://api.github.com/users/dahjelle","html_url":"https://github.com/dahjelle","followers_url":"https://api.github.com/users/dahjelle/followers","following_url":"https://api.github.com/users/dahjelle/following{/other_user}","gists_url":"https://api.github.com/users/dahjelle/gists{/gist_id}","starred_url":"https://api.github.com/users/dahjelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dahjelle/subscriptions","organizations_url":"https://api.github.com/users/dahjelle/orgs","repos_url":"https://api.github.com/users/dahjelle/repos","events_url":"https://api.github.com/users/dahjelle/events{/privacy}","received_events_url":"https://api.github.com/users/dahjelle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-29T21:54:56Z","updated_at":"2016-08-29T21:54:56Z","closed_at":null,"body":"Hi! I was experimenting with turning query batching on, but ran into an issue getting:\r\n\r\n```\r\nTypeError: Cannot read property '___authorStuff___requestIndex_0___fieldIndex_4' of undefined\r\n```\r\n\r\nI have one query that use a fragment in two different locations. It appears that the `fieldIndex` values are being computed differently between the request and what the response-processing (in `unpackDataForRequest`?) is expecting. (While this isn't my actual query, I think (hope) it's a reduced example.)\r\n\r\n# Query\r\n\r\n```\r\nquery authorStuff {\r\n  author {\r\n    ...authorInfo\r\n  }\r\n  secondAuthor {\r\n    ...authorInfo\r\n  }\r\n}\r\nfragment authorInfo on RootQuery {\r\n  firstName\r\n  lastName\r\n}\r\n```\r\n\r\n# \"Batched\" Query\r\n\r\n```\r\nquery query authorStuff {\r\n  ___authorStuff___requestIndex_0___fieldIndex_0: author {\r\n    ...___authorStuff___requestIndex_0___authorInfo\r\n  }\r\n  ___authorStuff___requestIndex_0___fieldIndex_1: secondAuthor {\r\n    ...___authorStuff___requestIndex_0___authorInfo\r\n  }\r\n}\r\n\r\nfragment ___authorStuff___requestIndex_0___authorInfo on RootQuery {\r\n  ___authorStuff___requestIndex_0___fieldIndex_2: firstName\r\n  ___authorStuff___requestIndex_0___fieldIndex_3: lastName\r\n}\r\n```\r\n\r\n# Response\r\n\r\n```\r\n{\r\n  data: {\r\n    ___authorStuff___requestIndex_0___fieldIndex_0: {\r\n      ___authorStuff___requestIndex_0___fieldIndex_2: 'John',\r\n      ___authorStuff___requestIndex_0___fieldIndex_3: 'Smith',\r\n    },\r\n    ___authorStuff___requestIndex_0___fieldIndex_1: {\r\n      ___authorStuff___requestIndex_0___fieldIndex_2: 'Joe',\r\n      ___authorStuff___requestIndex_0___fieldIndex_3: 'Smith',\r\n    },\r\n  },\r\n}\r\n```\r\n\r\n# Error\r\n\r\nBut I get an error that says:\r\n\r\n```\r\nTypeError: Cannot read property '___authorStuff___requestIndex_0___fieldIndex_4' of undefined\r\n```\r\n\r\n---\r\n\r\nIs there something obvious I'm missing? Should I put the above into the `queryMerging.ts` tests and then see how we might fix it? I've experimented with some fixes, but I'm not sure I grok `unpackDataForRequest` enough yet to get a proper fix.\r\n\r\nOr is there another approach I should be using?"}}
{"actor":{"display_login":"dahjelle"}}