{"action":"created","issue":{"url":"https://api.github.com/repos/apollographql/apollo-client/issues/3483","repository_url":"https://api.github.com/repos/apollographql/apollo-client","labels_url":"https://api.github.com/repos/apollographql/apollo-client/issues/3483/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/apollo-client/issues/3483/comments","events_url":"https://api.github.com/repos/apollographql/apollo-client/issues/3483/events","html_url":"https://github.com/apollographql/apollo-client/issues/3483","id":324679040,"node_id":"MDU6SXNzdWUzMjQ2NzkwNDA=","number":3483,"title":"graphql-anywhere filter function doesn't work with arrays","user":{"login":"dquang-tran","id":22584558,"node_id":"MDQ6VXNlcjIyNTg0NTU4","avatar_url":"https://avatars1.githubusercontent.com/u/22584558?v=4","gravatar_id":"","url":"https://api.github.com/users/dquang-tran","html_url":"https://github.com/dquang-tran","followers_url":"https://api.github.com/users/dquang-tran/followers","following_url":"https://api.github.com/users/dquang-tran/following{/other_user}","gists_url":"https://api.github.com/users/dquang-tran/gists{/gist_id}","starred_url":"https://api.github.com/users/dquang-tran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dquang-tran/subscriptions","organizations_url":"https://api.github.com/users/dquang-tran/orgs","repos_url":"https://api.github.com/users/dquang-tran/repos","events_url":"https://api.github.com/users/dquang-tran/events{/privacy}","received_events_url":"https://api.github.com/users/dquang-tran/received_events","type":"User","site_admin":false},"labels":[{"id":562484311,"node_id":"MDU6TGFiZWw1NjI0ODQzMTE=","url":"https://api.github.com/repos/apollographql/apollo-client/labels/confirmed","name":"confirmed","color":"d93f0b","default":false},{"id":521269263,"node_id":"MDU6TGFiZWw1MjEyNjkyNjM=","url":"https://api.github.com/repos/apollographql/apollo-client/labels/good-first-issue","name":"good-first-issue","color":"bfdadc","default":false},{"id":332593320,"node_id":"MDU6TGFiZWwzMzI1OTMzMjA=","url":"https://api.github.com/repos/apollographql/apollo-client/labels/help-wanted","name":"help-wanted","color":"159818","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-20T03:00:29Z","updated_at":"2018-06-19T18:58:41Z","closed_at":null,"author_association":"NONE","body":"The filter function invalidates a field if that field is an array instead of an object\r\n```\r\nimport { filter } from 'graphql-anywhere';\r\nimport gql from 'graphql-tag';\r\n\r\nconst peopleFragment = gql`\r\n  {\r\n    alias\r\n    height(unit: METERS)\r\n  }\r\n`;\r\nconst people = [{\r\n  alias: 'Bob',\r\n  height: 1.89,,\r\n}];\r\n```\r\n\r\n**Intended outcome:**\r\n```\r\nconsole.log(filter(peopleFragment, people))\r\n// Output\r\n[{\r\n  alias: 'Bob',\r\n  height: 1.89,\r\n}];\r\n\r\n```\r\n**Actual outcome:**\r\n```\r\nconsole.log(filter(peopleFragment, people))\r\n// Output\r\n// {};\r\n```\r\n\r\nThe unit test doesn't cover this case: https://github.com/apollographql/apollo-client/blob/master/packages/graphql-anywhere/src/__tests__/utilities.ts\r\n\r\nIs this function not expected to work on arrays? \r\n**Version**\r\n- apollo-client@1.4.0\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apollographql/apollo-client/issues/comments/398508455","html_url":"https://github.com/apollographql/apollo-client/issues/3483#issuecomment-398508455","issue_url":"https://api.github.com/repos/apollographql/apollo-client/issues/3483","id":398508455,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODUwODQ1NQ==","user":{"login":"dquang-tran","id":22584558,"node_id":"MDQ6VXNlcjIyNTg0NTU4","avatar_url":"https://avatars1.githubusercontent.com/u/22584558?v=4","gravatar_id":"","url":"https://api.github.com/users/dquang-tran","html_url":"https://github.com/dquang-tran","followers_url":"https://api.github.com/users/dquang-tran/followers","following_url":"https://api.github.com/users/dquang-tran/following{/other_user}","gists_url":"https://api.github.com/users/dquang-tran/gists{/gist_id}","starred_url":"https://api.github.com/users/dquang-tran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dquang-tran/subscriptions","organizations_url":"https://api.github.com/users/dquang-tran/orgs","repos_url":"https://api.github.com/users/dquang-tran/repos","events_url":"https://api.github.com/users/dquang-tran/events{/privacy}","received_events_url":"https://api.github.com/users/dquang-tran/received_events","type":"User","site_admin":false},"created_at":"2018-06-19T18:58:41Z","updated_at":"2018-06-19T18:58:41Z","author_association":"NONE","body":"Also, keep in mind that the `propType` function of 'graphql-anywhere' library will also need to be updated along with this change. Since the fragment can now represent both an object and an array, propTypes will also need to do `either .. or ..` type"}}
{"actor":{"display_login":"dquang-tran"}}