{"action":"created","issue":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/463","repository_url":"https://api.github.com/repos/apollographql/react-apollo","labels_url":"https://api.github.com/repos/apollographql/react-apollo/issues/463/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/react-apollo/issues/463/comments","events_url":"https://api.github.com/repos/apollographql/react-apollo/issues/463/events","html_url":"https://github.com/apollographql/react-apollo/issues/463","id":207939051,"number":463,"title":"Remove __typename property from query result [Request]","user":{"login":"sun2rise","id":3852307,"avatar_url":"https://avatars.githubusercontent.com/u/3852307?v=3","gravatar_id":"","url":"https://api.github.com/users/sun2rise","html_url":"https://github.com/sun2rise","followers_url":"https://api.github.com/users/sun2rise/followers","following_url":"https://api.github.com/users/sun2rise/following{/other_user}","gists_url":"https://api.github.com/users/sun2rise/gists{/gist_id}","starred_url":"https://api.github.com/users/sun2rise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sun2rise/subscriptions","organizations_url":"https://api.github.com/users/sun2rise/orgs","repos_url":"https://api.github.com/users/sun2rise/repos","events_url":"https://api.github.com/users/sun2rise/events{/privacy}","received_events_url":"https://api.github.com/users/sun2rise/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-02-15T21:49:41Z","updated_at":"2017-02-15T23:24:33Z","closed_at":"2017-02-15T22:49:42Z","body":"When i make a query the object that i got back includes the `__typename` property... is there a way to have a \"clean\" object with the requested properties only?\r\n\r\nThe way that it is now if i want to modify that object and mutate it back as update i got errors because it doesn't reflect the model anymore."},"comment":{"url":"https://api.github.com/repos/apollographql/react-apollo/issues/comments/280174867","html_url":"https://github.com/apollographql/react-apollo/issues/463#issuecomment-280174867","issue_url":"https://api.github.com/repos/apollographql/react-apollo/issues/463","id":280174867,"user":{"login":"calebmer","id":8282507,"avatar_url":"https://avatars.githubusercontent.com/u/8282507?v=3","gravatar_id":"","url":"https://api.github.com/users/calebmer","html_url":"https://github.com/calebmer","followers_url":"https://api.github.com/users/calebmer/followers","following_url":"https://api.github.com/users/calebmer/following{/other_user}","gists_url":"https://api.github.com/users/calebmer/gists{/gist_id}","starred_url":"https://api.github.com/users/calebmer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calebmer/subscriptions","organizations_url":"https://api.github.com/users/calebmer/orgs","repos_url":"https://api.github.com/users/calebmer/repos","events_url":"https://api.github.com/users/calebmer/events{/privacy}","received_events_url":"https://api.github.com/users/calebmer/received_events","type":"User","site_admin":false},"created_at":"2017-02-15T23:24:33Z","updated_at":"2017-02-15T23:24:33Z","body":"`__typename` allows us to know the type of the object we are querying from the API. There are a number of places where we need that information throughout Apollo Client 😊\r\n\r\nThe reason you are getting an error is not because of `omit`, but rather because of your assignments: `variables.registry =`, `variables.addresses =`, etc. So if we made `__typename` read only it wouldn’t matter.\r\n\r\nIf you _really_ want to omit `__typename` this will work:\r\n\r\n```js\r\nfunction omitTypename (value) {\r\n  if (value !== null && typeof value === 'object') {\r\n    const nextValue = {};\r\n    Object.keys(value).forEach(key => {\r\n      if (key !== '__typename') {\r\n        nextValue[key] = omitTypename(value[key]);\r\n      }\r\n    });\r\n    return nextValue;\r\n  } else if (Array.isArray(value)) {\r\n    return value.map(item => omitTypename(item));\r\n  } else {\r\n    return value;\r\n  }\r\n}\r\n```"}}
{"actor":{"display_login":"calebmer"}}