Skip to content

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

fix: Don't send the request twice when saving a policy from the Policy editor (#29899)

Ivan Vasilovf6cf84858e73
diff --git a/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/index.tsx b/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/index.tsx
index 6005512e4e6..b11333148e0 100644
--- a/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/index.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/AIPolicyEditorPanel/index.tsx
@@ -788,16 +788,18 @@ export const AIPolicyEditorPanel = memo(function ({
incomingChange !== undefined
}
onClick={() => {
- const sql = editorOneRef.current?.getValue().trim()
- if (!sql) return onSelectCancel()
- executeMutation({
- sql: sql,
- projectRef: selectedProject?.ref,
- connectionString: selectedProject?.connectionString,
- handleError: (error) => {
- throw error
- },
- })
+ if (editView === 'conversation') {
+ const sql = editorOneRef.current?.getValue().trim()
+ if (!sql) return onSelectCancel()
+ executeMutation({
+ sql: sql,
+ projectRef: selectedProject?.ref,
+ connectionString: selectedProject?.connectionString,
+ handleError: (error) => {
+ throw error
+ },
+ })
+ }
}}
tooltip={{
content: {