Files
supabase/apps/docs/app/graphiql/page.tsx
Ivan VasilovandCharis Lam 0cb08341f6 chore: Bump nextjs for the docs app (#35333)
* Bump all versions of postcss to 8.5.3.

* Run next/codemod on the docs app.

* Move two experimental flags into stable. Add next-mdx-remote as a transpiled package.

* Add extra folders to the clean command in docs.

* Fix type errors in docs test.

* Run prettier on the new files.

* remove turbopack, fix fetch revalidation, fix metadata awaits

Couple of minor fixes:
- Turbopack doesn't work in dev because of known MDX loader limitations
(cannot load functions in MDX plugin config)
- Fetches not cached by default anymore in Next 15 so need to manually
cache the ones we need
- Missing a few awaits for metadata generation with page params

* Bump the graphiql version because headlessui/react is not building with Next 15.

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-05-08 09:27:22 +00:00

34 lines
937 B
TypeScript

'use client'
import dynamic from 'next/dynamic'
import { notFound } from 'next/navigation'
import { type ComponentProps } from 'react'
import { IS_DEV } from '~/lib/constants'
const LazyGraphiQL = dynamic(
async () => {
const { GraphiQL: GraphiQLPrimitive } = await import('graphiql')
const { createGraphiQLFetcher } = await import('@graphiql/toolkit')
await import('graphiql/style.css')
return function GraphiQL(props: Omit<ComponentProps<typeof GraphiQLPrimitive>, 'fetcher'>) {
const fetcher = createGraphiQLFetcher({
url: 'http://localhost:3001/docs/api/graphql',
})
return <GraphiQLPrimitive fetcher={fetcher} {...props} />
}
},
{
loading: () => <div className="p-6">Loading GraphiQL...</div>,
ssr: false,
}
)
export default function GraphiQLPage() {
if (!IS_DEV) {
notFound()
}
return <LazyGraphiQL className="!h-[calc(100vh-var(--header-height))]" />
}