Skip to content

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

Skip JSON stringify cell values on string types to remove unnecessary double quotes (#34046)

Joshen Lim8120245eb7ea
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx
index dcfaa4cbff0..7a95e6ed439 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/Results.tsx
@@ -50,24 +50,29 @@ const Results = ({ rows }: { rows: readonly any[] }) => {
)
const formatter = (column: any, row: any) => {
+ const cellValue = row[column]
+
return (
<ContextMenu_Shadcn_ modal={false}>
<ContextMenuTrigger_Shadcn_ asChild>
<div
className={cn(
'flex items-center h-full font-mono text-xs w-full whitespace-pre',
- row[column] === null && 'text-foreground-lighter'
+ cellValue === null && 'text-foreground-lighter'
)}
>
- {row[column] === null ? 'NULL' : JSON.stringify(row[column])}
+ {cellValue === null
+ ? 'NULL'
+ : typeof cellValue === 'string'
+ ? cellValue
+ : JSON.stringify(cellValue)}
</div>
</ContextMenuTrigger_Shadcn_>
<ContextMenuContent_Shadcn_ onCloseAutoFocus={(e) => e.stopPropagation()}>
<ContextMenuItem_Shadcn_
className="gap-x-2"
onSelect={() => {
- const cellValue = row[column] ?? ''
- const value = formatClipboardValue(cellValue)
+ const value = formatClipboardValue(cellValue ?? '')
copyToClipboard(value)
}}
onFocusCapture={(e) => e.stopPropagation()}
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
index ed81d6dfddb..bf7ec329ff9 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
@@ -97,7 +97,7 @@ const UtilityTabResults = ({
) : (
<p className="font-mono text-sm tracking-tight">Error: {result.error?.message}</p>
)}
- {result.autoLimit && (
+ {!isTimeout && result.autoLimit && (
<p className="text-sm text-foreground-light">
Note: A limit of {result.autoLimit} was applied to your query. If this was the
cause of a syntax error, try selecting "No limit" instead and re-run the query.