The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Add isReadOnly flag into QueryEditor component (#49378)
Joshen Lim502e0f9b09ad
diff --git a/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx b/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsxindex 8285eb878f0..87b9579e860 100644--- a/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx+++ b/apps/studio/components/interfaces/Explorer/QueryEditor/index.tsx@@ -101,6 +101,7 @@ export type QueryEditorHandle = {type QueryEditorProps = {id: string+ isReadOnly?: booleanvariant: 'embedded' | 'viewport'title: stringquery: ExplorerQueryModel@@ -131,6 +132,7 @@ type QueryEditorProps = {export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(function QueryEditor({id,+ isReadOnly = false,variant,title,query,@@ -261,7 +263,7 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct}const acceptSqlProposal = () => {- if (!pendingProposal) return+ if (isReadOnly || !pendingProposal) returnif (sql === pendingProposal.original) {onSqlChange(pendingProposal.modified)onSqlCommit?.(pendingProposal.modified)@@ -381,6 +383,7 @@ export const QueryEditor = forwardRef<QueryEditorHandle, QueryEditorProps>(funct<CodeEditorid={`explorer-query-${id}`}language="pgsql"+ isReadOnly={isReadOnly}value={sql}placeholder={!promptState?.isOpen ? generatePlaceholder(os) : ''}placeholderClassName="top-[13px]"diff --git a/apps/studio/components/ui/AIAssistantPanel/AssistantQueryCell.tsx b/apps/studio/components/ui/AIAssistantPanel/AssistantQueryCell.tsxindex 6369797c915..d78769f65eb 100644--- a/apps/studio/components/ui/AIAssistantPanel/AssistantQueryCell.tsx+++ b/apps/studio/components/ui/AIAssistantPanel/AssistantQueryCell.tsx@@ -137,6 +137,7 @@ export const AssistantQueryCell = ({onConfirm={onApprove}><QueryEditor+ isReadOnlyid={id}variant="viewport"title={title}