Fix GQL operationName not being picked up somethings (Closes #1856)

This commit is contained in:
Gregory Schier committed 2019-12-18 16:07:23 -05:00
1 parent 3e3886205b
commit 905040db80
1 file changed
+4 -10
@@ -390,6 +390,8 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
}
_handleBodyChange(query: string, variables: ?Object, operationName: ?string): void {
this._setDocumentAST(query);
const body: GraphQLBody = { query };
if (variables) {
@@ -400,16 +402,6 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
body.operationName = operationName;
}
const newContent = GraphQLEditor._graphQLToString(body);
// This method gets called a lot so make sure we only do something if the
// new body has actually changed.
if (this.props.content === newContent) {
return;
}
this._setDocumentAST(query);
// Find op if there isn't one yet
if (!body.operationName) {
const newOperationName = this._getCurrentOperation();
@@ -418,6 +410,8 @@ class GraphQLEditor extends React.PureComponent<Props, State> {
}
}
const newContent = GraphQLEditor._graphQLToString(body);
this.setState({
variablesSyntaxError: '',
body,