{"action":"closed","issue":{"url":"https://api.github.com/repos/apollographql/apollo-client/issues/1386","repository_url":"https://api.github.com/repos/apollographql/apollo-client","labels_url":"https://api.github.com/repos/apollographql/apollo-client/issues/1386/labels{/name}","comments_url":"https://api.github.com/repos/apollographql/apollo-client/issues/1386/comments","events_url":"https://api.github.com/repos/apollographql/apollo-client/issues/1386/events","html_url":"https://github.com/apollographql/apollo-client/issues/1386","id":212946826,"number":1386,"title":"How to rollback optimisticResponse after mutation return a rejected promise","user":{"login":"cncolder","id":127009,"avatar_url":"https://avatars0.githubusercontent.com/u/127009?v=3","gravatar_id":"","url":"https://api.github.com/users/cncolder","html_url":"https://github.com/cncolder","followers_url":"https://api.github.com/users/cncolder/followers","following_url":"https://api.github.com/users/cncolder/following{/other_user}","gists_url":"https://api.github.com/users/cncolder/gists{/gist_id}","starred_url":"https://api.github.com/users/cncolder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cncolder/subscriptions","organizations_url":"https://api.github.com/users/cncolder/orgs","repos_url":"https://api.github.com/users/cncolder/repos","events_url":"https://api.github.com/users/cncolder/events{/privacy}","received_events_url":"https://api.github.com/users/cncolder/received_events","type":"User","site_admin":false},"labels":[{"id":332593317,"url":"https://api.github.com/repos/apollographql/apollo-client/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2017-03-09T06:26:39Z","updated_at":"2017-03-17T23:34:40Z","closed_at":"2017-03-17T23:34:40Z","body":"<!--\r\n  Thanks for filing an issue on Apollo Client!\r\n\r\n  Please make sure that you include the following information to ensure that your issue is actionable.\r\n\r\n  If you don't follow the template, your issue may not receive any attention, or it may be closed.\r\n\r\n  If you're filing a feature request, you do not need to follow the outline below, but please include \"feature idea\" in the title and include a specific example in which that feature would be useful.\r\n-->\r\n\r\n**Intended outcome:**\r\n\r\nDrop optimistic response if error.\r\n\r\n**Actual outcome:**\r\n\r\nApollo only dispatch `APOLLO_MUTATION_INIT` but not `APOLLO_MUTATION_RESULT` and leave optimistic response there.\r\n\r\n**How to reproduce the issue:**\r\n\r\n```js\r\n// In GraphQL server resolvers. Simple throw an error.\r\ncheck.assert.like(ctx.state.user, { id: '' }, 'unauthorized')\r\n  Mutation: {\r\n    async addPost (_, { title, content }, ctx) {\r\n      if (!ctx.state.user) throw new Error('unauthorized')\r\n\r\n      const user = await User.get(ctx.state.user.id)\r\n\r\n      return user.submitPost(title, content)\r\n    }\r\n  }\r\n```\r\n\r\n<!-- \r\n**Intended outcome:**\r\nWhat you were trying to accomplish when the bug occurred, and as much code as possible related to the source of the problem.\r\n\r\n**Actual outcome:**\r\nA description of what actually happened, including a screenshot or copy-paste of any related error messages, logs, or other output that might be related. Places to look for information include your browser console, server console, and network logs. Please avoid non-specific phrases like “didn’t work” or “broke”.\r\n\r\n**How to reproduce the issue:**\r\nInstructions for how the issue can be reproduced by a maintainer or contributor. Be as specific as possible, and only mention what is necessary to reproduce the bug. If possible, try to isolate the exact circumstances in which the bug occurs and avoid speculation over what the cause might be.\r\n-->"}}
{"actor":{"display_login":"helfer"}}