diff --git a/packages/graphiql/cypress/e2e/docs.cy.ts b/packages/graphiql/cypress/e2e/docs.cy.ts index 6a6278b23c..0dd2aaaeed 100644 --- a/packages/graphiql/cypress/e2e/docs.cy.ts +++ b/packages/graphiql/cypress/e2e/docs.cy.ts @@ -22,7 +22,7 @@ describe('GraphiQL DocExplorer - search', () => { beforeEach(() => { cy.get('.graphiql-sidebar button').eq(0).click(); cy.dataCy('doc-explorer-input').type('test'); - cy.dataCy('doc-explorer-option').should('have.length', 7); + cy.dataCy('doc-explorer-option').should('have.length', 8); }); it('Searches docs for values', () => { diff --git a/packages/graphql-language-service/src/interface/getAutocompleteSuggestions.ts b/packages/graphql-language-service/src/interface/getAutocompleteSuggestions.ts index 83b5c7987f..eb05178ca0 100644 --- a/packages/graphql-language-service/src/interface/getAutocompleteSuggestions.ts +++ b/packages/graphql-language-service/src/interface/getAutocompleteSuggestions.ts @@ -312,18 +312,18 @@ export function getAutocompleteSuggestions( (kind === RuleKinds.OBJECT_FIELD && step === 0)) && typeInfo.objectFieldDefs ) { - // @oneOf logic! - console.log(state.prevState?.prevState?.kind, !!typeInfo.inputType); + const { inputType, objectFieldDefs } = typeInfo; + const { string: tokenString } = token; if ( - typeInfo?.inputType && - 'isOneOf' in typeInfo.inputType && - typeInfo?.inputType?.isOneOf === true && - (state.prevState?.prevState?.kind !== 'Argument' || token.string !== '{') + inputType && + 'isOneOf' in inputType && + inputType?.isOneOf === true && + (prevState?.prevState?.kind !== 'Argument' || tokenString !== '{') ) { // return empty array early if a oneOf field has already been provided return []; } - const objectFields = objectValues(typeInfo.objectFieldDefs); + const objectFields = objectValues(objectFieldDefs); const completionKind = kind === RuleKinds.OBJECT_VALUE ? CompletionItemKind.Value