mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 15:39:13 +00:00
## Context We've been seeing many `NotFoundError: Failed to execute 'removeChild' on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on 'Node'` events on Sentry which are historically known to be caused by Google Translate in the browser. There's technically no _right way_ to address this unfortunately, but one of the solutions which should address most of these issues is to wrap any dynamic text within a span - we've considered that quite a while back tbh but never took the time to do this until today with the help of Claude. Although just a heads up that it might not necessarily completely eradicate those issues. Also added an eslint rule which should prevent future occurences of this <img width="1264" height="192" alt="image" src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29" />
73 lines
2.1 KiB
TypeScript
73 lines
2.1 KiB
TypeScript
import {
|
|
AlertDialog,
|
|
AlertDialogAction,
|
|
AlertDialogCancel,
|
|
AlertDialogContent,
|
|
AlertDialogDescription,
|
|
AlertDialogFooter,
|
|
AlertDialogHeader,
|
|
AlertDialogTitle,
|
|
} from 'ui'
|
|
|
|
import { InlineLink } from '@/components/ui/InlineLink'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
interface RLSToggleDialogProps {
|
|
open: boolean
|
|
tableName?: string
|
|
isEnabled: boolean
|
|
isSubmitting?: boolean
|
|
onOpenChange: (open: boolean) => void
|
|
onConfirm: () => void | Promise<void>
|
|
}
|
|
|
|
export function RLSToggleDialog({
|
|
open,
|
|
isEnabled,
|
|
isSubmitting = false,
|
|
onOpenChange,
|
|
onConfirm,
|
|
}: RLSToggleDialogProps) {
|
|
return (
|
|
<AlertDialog open={open} onOpenChange={onOpenChange}>
|
|
<AlertDialogContent>
|
|
<AlertDialogHeader>
|
|
<AlertDialogTitle>
|
|
{isEnabled ? 'Disable Row Level Security' : 'Enable Row Level Security'}
|
|
</AlertDialogTitle>
|
|
<AlertDialogDescription>
|
|
{isEnabled ? (
|
|
<>
|
|
This table will become publicly readable and writable.{' '}
|
|
<span className="font-medium text-foreground">
|
|
Anyone can view, add, update, or delete data in this table
|
|
</span>
|
|
, and existing RLS policies will no longer apply.
|
|
</>
|
|
) : (
|
|
<span>
|
|
RLS restricts table access until policies allow a request. Existing queries may stop
|
|
returning rows until policies are added.
|
|
</span>
|
|
)}{' '}
|
|
<InlineLink href={`${DOCS_URL}/guides/database/postgres/row-level-security`}>
|
|
Learn more
|
|
</InlineLink>
|
|
<span>.</span>
|
|
</AlertDialogDescription>
|
|
</AlertDialogHeader>
|
|
<AlertDialogFooter>
|
|
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
<AlertDialogAction
|
|
variant={isEnabled ? 'danger' : 'primary'}
|
|
loading={isSubmitting}
|
|
onClick={() => onConfirm()}
|
|
>
|
|
{isEnabled ? 'Disable RLS' : 'Enable RLS'}
|
|
</AlertDialogAction>
|
|
</AlertDialogFooter>
|
|
</AlertDialogContent>
|
|
</AlertDialog>
|
|
)
|
|
}
|