{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/relay/issues/236","labels_url":"https://api.github.com/repos/facebook/relay/issues/236/labels{/name}","comments_url":"https://api.github.com/repos/facebook/relay/issues/236/comments","events_url":"https://api.github.com/repos/facebook/relay/issues/236/events","html_url":"https://github.com/facebook/relay/issues/236","id":104796491,"number":236,"title":"Why should we avoid using 'REQUIRED_CHILDREN' for a mutation?","user":{"login":"ashinohara","id":26411,"avatar_url":"https://avatars.githubusercontent.com/u/26411?v=3","gravatar_id":"","url":"https://api.github.com/users/ashinohara","html_url":"https://github.com/ashinohara","followers_url":"https://api.github.com/users/ashinohara/followers","following_url":"https://api.github.com/users/ashinohara/following{/other_user}","gists_url":"https://api.github.com/users/ashinohara/gists{/gist_id}","starred_url":"https://api.github.com/users/ashinohara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ashinohara/subscriptions","organizations_url":"https://api.github.com/users/ashinohara/orgs","repos_url":"https://api.github.com/users/ashinohara/repos","events_url":"https://api.github.com/users/ashinohara/events{/privacy}","received_events_url":"https://api.github.com/users/ashinohara/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-03T22:48:16Z","updated_at":"2015-09-04T20:58:53Z","closed_at":null,"body":"I am attempting use the relay-starter-kit to make a createWidgetMutation that looks like this:\r\n\r\n```javascript\r\nvar createWidgetMutation = mutationWithClientMutationId({\r\n  name: 'CreateWidget',\r\n  inputFields: {\r\n    name: {\r\n        type: new GraphQLNonNull(GraphQLString)\r\n    },\r\n  },\r\n  outputFields: {\r\n    widget: {\r\n      type: widgetType\r\n    },\r\n    widgetId: {\r\n      type: GraphQLString\r\n    },\r\n  },\r\n  mutateAndGetPayload: (payload) => {\r\n    console.log('createWidget', payload);\r\n    var result = {widget: {name: 'test widget'}, widgetId: 1};\r\n    return Promise.resolve(result);\r\n  }\r\n});\r\n```\r\n\r\nWhen I use FIELDS_CHANGE as the mutation config, the widget object does not get passed back in the payload, but widgetId is passed back.  When I use REQUIRED_CHILDREN, the object does get passed back, but the documentation for REQUIRED_CHILDREN says to avoid using this type.  What should I use instead of REQUIRED_CHILDREN?\r\n\r\nMy mutation looks like this for REQUIRED_CHILDREN:\r\n\r\n```javascript\r\nexport default class CreateWidgetMutation extends Relay.Mutation {\r\n    static fragments = {\r\n        widget: () => Relay.QL`\r\n            fragment on Widget {\r\n                name\r\n            }\r\n        `,\r\n    };\r\n\r\n    getMutation() {\r\n        return Relay.QL`\r\n        mutation {\r\n            createWidget\r\n        }`;\r\n    }\r\n    getVariables() {\r\n        return {\r\n            name: this.props.name\r\n        };\r\n    }\r\n    getFatQuery() {\r\n        return Relay.QL`\r\n        fragment on CreateWidgetPayload {\r\n            widget,\r\n            widgetId\r\n        }\r\n        `;\r\n    }\r\n    getConfigs() {\r\n        return [{\r\n            type: 'REQUIRED_CHILDREN',\r\n            children: [Relay.QL`\r\n            fragment on CreateWidgetPayload {\r\n                widget {\r\n                    name\r\n                },\r\n                widgetId\r\n            }\r\n            `]\r\n        }];\r\n    }\r\n}\r\n```\r\n\r\nand the getConfigs looks like this for FIELDS_CHANGE:\r\n\r\n```javascript\r\n    getConfigs() {\r\n        return [{\r\n            type: 'FIELDS_CHANGE',\r\n            fieldIDs: {\r\n                widget: null,\r\n                widgetId: null\r\n            },\r\n        }];\r\n    }\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/relay/issues/comments/137850978","html_url":"https://github.com/facebook/relay/issues/236#issuecomment-137850978","issue_url":"https://api.github.com/repos/facebook/relay/issues/236","id":137850978,"user":{"login":"yungsters","id":55161,"avatar_url":"https://avatars.githubusercontent.com/u/55161?v=3","gravatar_id":"","url":"https://api.github.com/users/yungsters","html_url":"https://github.com/yungsters","followers_url":"https://api.github.com/users/yungsters/followers","following_url":"https://api.github.com/users/yungsters/following{/other_user}","gists_url":"https://api.github.com/users/yungsters/gists{/gist_id}","starred_url":"https://api.github.com/users/yungsters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yungsters/subscriptions","organizations_url":"https://api.github.com/users/yungsters/orgs","repos_url":"https://api.github.com/users/yungsters/repos","events_url":"https://api.github.com/users/yungsters/events{/privacy}","received_events_url":"https://api.github.com/users/yungsters/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T20:58:53Z","updated_at":"2015-09-04T20:58:53Z","body":"Filed #237."}}