Files
supabase/apps/studio/components/interfaces/Settings/Logs/ErrorCodeDialog.tsx
Ivan VasilovandClaude Sonnet 5.5 fe7b3ad6af chore: bump @graphql-codegen and its deps (#52785)
## Problem

`@graphql-codegen/cli` and related packages in `apps/studio` and
`apps/docs` were pinned to old major versions (`cli` 5.0.5, `typescript`
4.1.6, `typescript-resolvers` 4.5.0).

## Solution

- Bump `@graphql-codegen/cli` to `^7.0.0` and
`@graphql-codegen/typescript-resolvers` to `^6.0.0`. Drop the explicit
`@graphql-codegen/typescript` dependency from `apps/docs`.
- Regenerate the Studio GraphQL output in `apps/studio/data/graphql/`
with the new codegen. The generated files now include an `index.ts`
export change, and `graphql.ts` is much smaller.
- Refresh `apps/studio/scripts/schema.graphql`, which picks up the new
`ManagementApiReference` search result type.
- Update `.prettierignore` (ignore `apps/studio/.output`,
`apps/studio/dist`, and all of `apps/ui-library/public`) and run
Prettier on the regenerated files.

## Review instructions

1. Check the dependency bumps in `apps/studio/package.json` and
`apps/docs/package.json`.
2. Re-run the Studio codegen and confirm it produces no diff in
`apps/studio/data/graphql/`.
3. Run `pnpm typecheck` and confirm the GraphQL consumers in Studio
still compile.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-06 14:01:38 +00:00

114 lines
2.7 KiB
TypeScript

import { AlertTriangleIcon } from 'lucide-react'
import {
Alert,
AlertDescription,
AlertTitle,
Badge,
Button_Shadcn_,
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from 'ui'
import { ShimmeringLoader } from 'ui-patterns/ShimmeringLoader'
import { useErrorCodesQuery } from '@/data/content-api/docs-error-codes-query'
import type { ErrorCodeQueryQuery, Service } from '@/data/graphql/graphql'
interface ErrorCodeDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
errorCode: string
service?: Service
}
export const ErrorCodeDialog = ({
open,
onOpenChange,
errorCode,
service,
}: ErrorCodeDialogProps) => {
const {
data,
isPending: isLoading,
isSuccess,
refetch,
} = useErrorCodesQuery({ code: errorCode, service }, { enabled: open })
return (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent>
<DialogHeader>
<DialogTitle className="mb-4">
Help for error code <code>{errorCode}</code>
</DialogTitle>
<DialogDescription>
{isLoading && <LoadingState />}
{isSuccess && <SuccessState data={data} />}
{!isLoading && !isSuccess && <ErrorState refetch={refetch} />}
</DialogDescription>
</DialogHeader>
</DialogContent>
</Dialog>
)
}
const LoadingState = () => (
<>
<ShimmeringLoader className="w-3/4 mb-2" />
<ShimmeringLoader className="w-1/2" />
</>
)
const SuccessState = ({ data }: { data: ErrorCodeQueryQuery | undefined }) => {
const errors = data?.errors?.nodes?.filter((error) => !!error.message)
if (!errors || errors.length === 0) {
return <>No information found for this error code.</>
}
return (
<>
<p className="mb-4">Possible explanations for this error:</p>
<div className="grid gap-2 grid-cols-[max-content_1fr]">
{errors.map((error) => (
<ErrorExplanation key={`${error.service}-${error.code}`} {...error} />
))}
</div>
</>
)
}
const ErrorExplanation = ({
service,
message,
}: {
code: string
service: Service
message?: string | null
}) => {
if (!message) return null
return (
<>
<Badge className="h-fit">{service}</Badge>
<p>{message}</p>
</>
)
}
const ErrorState = ({ refetch }: { refetch?: () => void }) => (
<Alert variant="warning">
<AlertTriangleIcon />
<AlertTitle>Lookup failed</AlertTitle>
<AlertDescription>
<p>Failed to look up error code help info</p>
{refetch && (
<Button_Shadcn_ variant="outline" size="sm" className="mt-2" onClick={refetch}>
Try again
</Button_Shadcn_>
)}
</AlertDescription>
</Alert>
)