Files
supabase/apps/studio/components/ui/InlineLink.tsx
Andrew ValleteauandJoshen Lim 4a3baa6ab6 fix(studio): Handle query timeout error (#34865)
* fix(studio): Handle query timeout error

There is a global timeout of about 50s on /query endpoint
This would fail the request independently from the user statement timeout setting
add a case to handle this error and add a CTA to suggest the user of direct
connection for long running queries

* chore: apply pr comments

* Tiny refactor

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-04-18 16:08:37 +08:00

35 lines
820 B
TypeScript

import Link from 'next/link'
import { PropsWithChildren } from 'react'
import { cn } from 'ui'
interface InlineLinkProps {
href: string
className?: string
target?: string
rel?: string
}
export const InlineLinkClassName =
'underline transition underline-offset-2 decoration-foreground-lighter hover:decoration-foreground text-foreground'
export const InlineLink = ({
href,
className: _className,
children,
...props
}: PropsWithChildren<InlineLinkProps>) => {
const className = cn(InlineLinkClassName, _className)
if (href.startsWith('http')) {
return (
<a className={className} href={href} target="_blank" rel="noreferrer noopener" {...props}>
{children}
</a>
)
}
return (
<Link className={className} href={href} {...props}>
{children}
</Link>
)
}