import { LOCAL_STORAGE_KEYS, useParams } from 'common' import { ChevronDown, ChevronUp } from 'lucide-react' import { useState } from 'react' import { Button } from 'ui' import { Admonition } from 'ui-patterns/admonition' import { PG_GRAPHQL_CONFIG_DOCS_URL } from './constants' import { IntrospectionConfirmModal } from './IntrospectionConfirmModal' import { useSetIntrospection } from './useSetIntrospection' import { InlineLink } from '@/components/ui/InlineLink' import { useLocalStorageQuery } from '@/hooks/misc/useLocalStorage' interface IntrospectionDisabledNoticeProps { schema: string currentSchemaComment: string | null | undefined onEnabled: () => void } export const IntrospectionDisabledNotice = ({ schema, currentSchemaComment, onEnabled, }: IntrospectionDisabledNoticeProps) => { const { ref: projectRef } = useParams() const [showConfirm, setShowConfirm] = useState(false) const [isCollapsed, setIsCollapsed] = useLocalStorageQuery( LOCAL_STORAGE_KEYS.GRAPHQL_INTROSPECTION_NOTICE_COLLAPSED(projectRef ?? ''), false ) const { apply, isPending, sql, existingDirectiveIsMalformed, otherExistingKeys } = useSetIntrospection({ schema, currentSchemaComment, enabled: true, onMutationSuccess: () => setShowConfirm(false), onInvalidated: onEnabled, }) return ( <> {isCollapsed ? (
GraphiQL relies on introspection to populate the docs explorer and field autocomplete.
With pg_graphql 1.6+, introspection is disabled by default so that
schemas aren't enumerable via the API. You can still run queries — only schema
discovery is affected.{' '}