Skip to content

Commit

Permalink
fix: dont use initial query on every re-render (#1663)
Browse files Browse the repository at this point in the history
Co-authored-by: Jimmy Bergman <jimmy@sigint.se>
  • Loading branch information
acao and jimmybergman committed Sep 10, 2020
1 parent fa5fe7e commit 5aa890f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,19 @@ export class GraphiQL extends React.Component<GraphiQLProps, GraphiQLState> {
if (nextProps.schema !== undefined) {
nextSchema = nextProps.schema;
}
if (nextProps.query !== undefined) {
if (nextProps.query !== undefined && this.props.query !== nextProps.query) {
nextQuery = nextProps.query;
}
if (nextProps.variables !== undefined) {
if (
nextProps.variables !== undefined &&
this.props.variables !== nextProps.variables
) {
nextVariables = nextProps.variables;
}
if (nextProps.headers !== undefined) {
if (
nextProps.headers !== undefined &&
this.props.headers !== nextProps.headers
) {
nextHeaders = nextProps.headers;
}
if (nextProps.operationName !== undefined) {
Expand Down

0 comments on commit 5aa890f

Please sign in to comment.