Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: Fix Studio crashes when using Google Translate (#29773)

Ivan Vasilov61ff33b40d3e
diff --git a/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx b/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx
index 40a7734b856..10f5361f10c 100644
--- a/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx
+++ b/apps/studio/components/interfaces/Linter/LinterPageFooter.tsx
@@ -39,10 +39,15 @@ const LinterPageFooter = ({
className={cn(hideDbInspectCTA ? 'w-[35%]' : 'w-[33%]', 'flex flex-col gap-y-1 text-sm')}
>
<p>How are these suggestions generated?</p>
- <Markdown
- className="text-xs"
- content="These suggestions use [splinter (Supabase Postgres LINTER)](https://github.com/supabase/splinter)."
- />
+ <div className="prose text-xs">
+ <p>
+ <span>These suggestions use </span>
+ <a href="https://github.com/supabase/splinter" target="" rel="">
+ splinter (Supabase Postgres LINTER)
+ </a>
+ .
+ </p>
+ </div>
</div>
{!hideDbInspectCTA && (
diff --git a/apps/studio/components/interfaces/Support/SupportFormV2.tsx b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
index 1c554dd9225..f9649b5c160 100644
--- a/apps/studio/components/interfaces/Support/SupportFormV2.tsx
+++ b/apps/studio/components/interfaces/Support/SupportFormV2.tsx
@@ -440,7 +440,7 @@ export const SupportFormV2 = ({ setSentCategory, setSelectedProject }: SupportFo
onValueChange={field.onChange}
>
<SelectTrigger_Shadcn_ className="w-full">
- <SelectValue_Shadcn_ placeholder="Select a project">
+ <SelectValue_Shadcn_ placeholder="Select a severity">
{field.value}
</SelectValue_Shadcn_>
</SelectTrigger_Shadcn_>
diff --git a/packages/ui/src/components/shadcn/ui/select.tsx b/packages/ui/src/components/shadcn/ui/select.tsx
index 9ae5ea35d2d..8bc84d8b5f8 100644
--- a/packages/ui/src/components/shadcn/ui/select.tsx
+++ b/packages/ui/src/components/shadcn/ui/select.tsx
@@ -4,15 +4,29 @@ import * as SelectPrimitive from '@radix-ui/react-select'
import { Check, ChevronDown, ChevronUp } from 'lucide-react'
import * as React from 'react'
-import { cn } from '../../../lib/utils/cn'
import { VariantProps, cva } from 'class-variance-authority'
import { SIZE_VARIANTS, SIZE_VARIANTS_DEFAULT } from '../../../lib/constants'
+import { cn } from '../../../lib/utils/cn'
const Select = SelectPrimitive.Root
const SelectGroup = SelectPrimitive.Group
-const SelectValue = SelectPrimitive.Value
+// If placeholder is a string, wrap it in a span. This is to avoid page crashes when using Google Translate.
+// https://github.com/radix-ui/primitives/issues/2578#issuecomment-1890801041 for more info.
+const SelectValue = React.forwardRef<
+ React.ElementRef<typeof SelectPrimitive.Value>,
+ React.ComponentPropsWithoutRef<typeof SelectPrimitive.Value> &
+ VariantProps<typeof SelectTriggerVariants>
+>(({ placeholder, ...props }, ref) => (
+ <SelectPrimitive.Value
+ placeholder={typeof placeholder === 'string' ? <span>{placeholder}</span> : placeholder}
+ {...props}
+ ref={ref}
+ />
+))
+
+SelectValue.displayName = SelectPrimitive.Value.displayName
const SelectTriggerVariants = cva('', {
variants: {
@@ -129,6 +143,8 @@ const SelectLabel = React.forwardRef<
))
SelectLabel.displayName = SelectPrimitive.Label.displayName
+// If children is a string, wrap it in a span. This is to avoid page crashes when using Google Translate.
+// https://github.com/radix-ui/primitives/issues/2578#issuecomment-1890801041 for more info.
const SelectItem = React.forwardRef<
React.ElementRef<typeof SelectPrimitive.Item>,
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
@@ -148,7 +164,9 @@ const SelectItem = React.forwardRef<
</SelectPrimitive.ItemIndicator>
</span>
- <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
+ <SelectPrimitive.ItemText>
+ {typeof children === 'string' ? <span>{children}</span> : children}
+ </SelectPrimitive.ItemText>
</SelectPrimitive.Item>
))
SelectItem.displayName = SelectPrimitive.Item.displayName
@@ -171,9 +189,9 @@ export {
SelectGroup,
SelectItem,
SelectLabel,
+ SelectScrollDownButton,
+ SelectScrollUpButton,
SelectSeparator,
SelectTrigger,
SelectValue,
- SelectScrollUpButton,
- SelectScrollDownButton,
}