diff --git a/src-web/components/GraphQLEditor.tsx b/src-web/components/GraphQLEditor.tsx index ed3c06ed..0d9227cf 100644 --- a/src-web/components/GraphQLEditor.tsx +++ b/src-web/components/GraphQLEditor.tsx @@ -65,11 +65,7 @@ export function GraphQLEditor({ body, onChange, baseRequest, ...extraEditorProps const actions = useMemo( () => [
- {isLoading ? ( - - ) : !error ? ( + {schema === undefined ? null /* Initializing */ : !error ? ( , }, - {type: 'separator', label: 'Setting'}, + { type: 'separator', label: 'Setting' }, { key: 'auto_fetch', label: 'Automatic Introspection', @@ -112,9 +108,10 @@ export function GraphQLEditor({ body, onChange, baseRequest, ...extraEditorProps size="sm" variant="border" title="Refetch Schema" - color={schema ? 'default' : 'warning'} + isLoading={isLoading} + color={isLoading || schema ? 'default' : 'warning'} > - {schema ? 'Schema' : 'No Schema'} + {isLoading ? 'Introspecting' : schema ? 'Schema' : 'No Schema'} ) : ( diff --git a/src-web/hooks/useIntrospectGraphQL.ts b/src-web/hooks/useIntrospectGraphQL.ts index 30caefd3..43439a4e 100644 --- a/src-web/hooks/useIntrospectGraphQL.ts +++ b/src-web/hooks/useIntrospectGraphQL.ts @@ -85,8 +85,11 @@ export function useIntrospectGraphQL( }, [setIntrospection]); const schema = useMemo(() => { + if (introspection == null) { + return introspection; + } try { - return introspection ? buildClientSchema(introspection) : undefined; + return buildClientSchema(introspection); // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (e: any) { setError('message' in e ? e.message : String(e));