From e1b3cc5ad6c71070306e1a0294cbe1190427e9b7 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Wed, 11 Dec 2024 15:03:18 +0700 Subject: [PATCH] aa --- packages/graphiql-react/src/schema.tsx | 31 +++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/graphiql-react/src/schema.tsx b/packages/graphiql-react/src/schema.tsx index 70061c4190..c224e13fe8 100644 --- a/packages/graphiql-react/src/schema.tsx +++ b/packages/graphiql-react/src/schema.tsx @@ -15,6 +15,7 @@ import { isSchema, validateSchema, } from 'graphql'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports -- unit tests fails without this useCallback import { ReactNode, useCallback, useEffect, useRef, useState } from 'react'; import { useEditorContext } from './editor'; @@ -152,6 +153,19 @@ export function SchemaContextProvider(props: SchemaContextProviderProps) { } }); + /** + * Get introspection query for settings given via props + */ + const { + introspectionQuery, + introspectionQueryName, + introspectionQuerySansSubscriptions, + } = useIntrospectionQuery({ + inputValueDeprecation: props.inputValueDeprecation, + introspectionQueryName: props.introspectionQueryName, + schemaDescription: props.schemaDescription, + }); + /** * Fetch the schema */ @@ -165,19 +179,6 @@ export function SchemaContextProvider(props: SchemaContextProviderProps) { return; } - /** - * Get introspection query for settings given via props - */ - const { - introspectionQuery, - introspectionQueryName, - introspectionQuerySansSubscriptions, - } = useIntrospectionQuery({ - inputValueDeprecation: props.inputValueDeprecation, - introspectionQueryName: props.introspectionQueryName, - schemaDescription: props.schemaDescription, - }); - const counter = ++counterRef.current; const maybeIntrospectionData = props.schema; @@ -297,7 +298,7 @@ export function SchemaContextProvider(props: SchemaContextProviderProps) { * Trigger introspection automatically */ useEffect(() => { - introspect(); + void introspect(); }, [introspect]); /** @@ -306,7 +307,7 @@ export function SchemaContextProvider(props: SchemaContextProviderProps) { useEffect(() => { function triggerIntrospection(event: KeyboardEvent) { if (event.ctrlKey && event.key === 'R') { - introspect(); + void introspect(); } }