From 3fdbfddddeac5351b99bb980920a49070c2bbb4d Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Mon, 17 Apr 2023 17:01:14 +0200 Subject: [PATCH] Apply suggestions from code review --- packages/graphiql-react/src/editor/header-editor.ts | 4 ++-- packages/graphiql-react/src/editor/variable-editor.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/graphiql-react/src/editor/header-editor.ts b/packages/graphiql-react/src/editor/header-editor.ts index 8fea2252564..db700f56fea 100644 --- a/packages/graphiql-react/src/editor/header-editor.ts +++ b/packages/graphiql-react/src/editor/header-editor.ts @@ -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'); } }); diff --git a/packages/graphiql-react/src/editor/variable-editor.ts b/packages/graphiql-react/src/editor/variable-editor.ts index 8c82d43995d..2213c383e27 100644 --- a/packages/graphiql-react/src/editor/variable-editor.ts +++ b/packages/graphiql-react/src/editor/variable-editor.ts @@ -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'); } });