Skip to content

Commit 5aa890f

Browse files
acaojimmybergman
andauthored
fix: dont use initial query on every re-render (#1663)
Co-authored-by: Jimmy Bergman <[email protected]>
1 parent fa5fe7e commit 5aa890f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/graphiql/src/components/GraphiQL.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,19 @@ export class GraphiQL extends React.Component<GraphiQLProps, GraphiQLState> {
320320
if (nextProps.schema !== undefined) {
321321
nextSchema = nextProps.schema;
322322
}
323-
if (nextProps.query !== undefined) {
323+
if (nextProps.query !== undefined && this.props.query !== nextProps.query) {
324324
nextQuery = nextProps.query;
325325
}
326-
if (nextProps.variables !== undefined) {
326+
if (
327+
nextProps.variables !== undefined &&
328+
this.props.variables !== nextProps.variables
329+
) {
327330
nextVariables = nextProps.variables;
328331
}
329-
if (nextProps.headers !== undefined) {
332+
if (
333+
nextProps.headers !== undefined &&
334+
this.props.headers !== nextProps.headers
335+
) {
330336
nextHeaders = nextProps.headers;
331337
}
332338
if (nextProps.operationName !== undefined) {

0 commit comments

Comments
 (0)