Skip to content

Commit ce7b2e2

Browse files
harshithpabbatiacao
authored andcommitted
fix: display variable editor when headers are not enabled
1 parent 4a26218 commit ce7b2e2

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

packages/graphiql/src/components/GraphiQL.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2019 GraphQL Contributors.
2+
* Copyright (c) 2020 GraphQL Contributors.
33
*
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -269,7 +269,9 @@ export class GraphiQL extends React.Component<GraphiQLProps, GraphiQLState> {
269269
Number(this._storage.get('secondaryEditorHeight')) || 200,
270270
variableEditorActive:
271271
this._storage.get('variableEditorActive') === 'true' ||
272-
this._storage.get('headerEditorActive') !== 'true',
272+
props.headerEditorEnabled
273+
? this._storage.get('headerEditorActive') !== 'true'
274+
: secondaryEditorOpen && true,
273275
headerEditorActive: this._storage.get('headerEditorActive') === 'true',
274276
headerEditorEnabled,
275277
historyPaneOpen: this._storage.get('historyPaneOpen') === 'true' || false,

packages/graphiql/src/components/__tests__/GraphiQL.spec.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,7 @@ describe('GraphiQL', () => {
141141
const { container: container1 } = render(
142142
<GraphiQL fetcher={noOpFetcher} />,
143143
);
144-
const queryVariables = container1.querySelector(
145-
'[aria-label="Query Variables"]',
146-
);
144+
const queryVariables = container1.querySelector('.variable-editor');
147145

148146
expect(queryVariables.style.height).toEqual('');
149147

@@ -168,9 +166,7 @@ describe('GraphiQL', () => {
168166
defaultVariableEditorOpen={false}
169167
/>,
170168
);
171-
const queryVariables3 = container3.querySelector(
172-
'[aria-label="Query Variables"]',
173-
);
169+
const queryVariables3 = container3.querySelector('.variable-editor');
174170
expect(queryVariables3?.style.height).toEqual('');
175171
});
176172

0 commit comments

Comments
 (0)