import type { React } from '#dep/react/index' import { useEffect, useState } from 'react' import { useGraphQLSchema } from '../schema-context.js' import { GraphQLDocument, type GraphQLDocumentProps } from './GraphQLDocument.js' /** * GraphQL Document component that uses the schema context */ export const GraphQLDocumentWithSchema: React.FC> = ( props, ) => { const schema = useGraphQLSchema() const [mounted, setMounted] = useState(false) useEffect(() => { setMounted(true) }, []) // Always render the same structure to avoid hydration issues const isInteractive = mounted && schema if (!isInteractive) { // Static fallback return (
          {props.children}
        
) } return ( ) }