Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri POSTOLOV authored Apr 17, 2023
1 parent 4092fe2 commit 3fdbfdd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/editor/header-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export function useHeaderEditor(
newEditor.on('keyup', (editorInstance, event) => {
const { code, key, shiftKey } = event;
const isLetter = code.startsWith('Key');
const isNumber = code.startsWith('Digit');
if (isLetter || (!shiftKey && isNumber) || key === '_' || key === '"') {
const isNumber = !shiftKey && code.startsWith('Digit');
if (isLetter || isNumber || key === '_' || key === '"') {
editorInstance.execCommand('autocomplete');
}
});
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-react/src/editor/variable-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export function useVariableEditor(
newEditor.on('keyup', (editorInstance, event) => {
const { code, key, shiftKey } = event;
const isLetter = code.startsWith('Key');
const isNumber = code.startsWith('Digit');
if (isLetter || (!shiftKey && isNumber) || key === '_' || key === '"') {
const isNumber = !shiftKey && code.startsWith('Digit');
if (isLetter || isNumber || key === '_' || key === '"') {
editorInstance.execCommand('autocomplete');
}
});
Expand Down

0 comments on commit 3fdbfdd

Please sign in to comment.