mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +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" />
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import { FileStackIcon } from 'lucide-react'
|
|
import { Badge, Tooltip, TooltipContent, TooltipTrigger } from 'ui'
|
|
|
|
import { getBucketVersioningState } from './StorageVersioning.constants'
|
|
import { useIsStorageVersioningEnabled } from '@/components/interfaces/App/FeaturePreview/FeaturePreviewContext'
|
|
import type { Bucket } from '@/data/storage/buckets-query'
|
|
|
|
const COPY = {
|
|
enabled: {
|
|
variant: 'success' as const,
|
|
state: 'Enabled',
|
|
tooltip: 'Overwriting or archiving a file keeps a recoverable copy.',
|
|
},
|
|
suspended: {
|
|
variant: 'warning' as const,
|
|
state: 'Suspended',
|
|
tooltip: 'Existing versions stay retained, but new writes are not versioned.',
|
|
},
|
|
}
|
|
|
|
interface BucketVersioningPillProps {
|
|
bucket?: Bucket
|
|
showPrefix?: boolean
|
|
}
|
|
|
|
export const BucketVersioningPill = ({ bucket, showPrefix = true }: BucketVersioningPillProps) => {
|
|
const isStorageVersioningEnabled = useIsStorageVersioningEnabled()
|
|
const versioningState = getBucketVersioningState(bucket)
|
|
|
|
if (!isStorageVersioningEnabled || versioningState === 'disabled') return null
|
|
|
|
const { variant, state, tooltip } = COPY[versioningState]
|
|
|
|
return (
|
|
<Tooltip>
|
|
<TooltipTrigger asChild>
|
|
<span tabIndex={0} className="shrink-0">
|
|
<Badge variant={variant}>
|
|
<FileStackIcon size={12} aria-hidden />
|
|
{showPrefix ? <span>{`Versioning ${state.toLowerCase()}`}</span> : state}
|
|
</Badge>
|
|
</span>
|
|
</TooltipTrigger>
|
|
<TooltipContent side="bottom" className="max-w-64">
|
|
{tooltip}
|
|
</TooltipContent>
|
|
</Tooltip>
|
|
)
|
|
}
|