Skip to content

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

chore: fixed issue when delete sorted column cause crash on table editor (#19178)

Austin Trana637a738474f
diff --git a/apps/studio/components/grid/SupabaseGrid.tsx b/apps/studio/components/grid/SupabaseGrid.tsx
index ff5d1b28f23..77c171e89af 100644
--- a/apps/studio/components/grid/SupabaseGrid.tsx
+++ b/apps/studio/components/grid/SupabaseGrid.tsx
@@ -83,6 +83,20 @@ const SupabaseGridLayout = (props: SupabaseGridProps) => {
},
{
keepPreviousData: true,
+ retryDelay: (retryAttempt, error: any) => {
+ if (error && error.message?.includes('does not exist')) {
+ setParams((prevParams) => {
+ return {
+ ...prevParams,
+ ...{ sort: undefined },
+ }
+ })
+ }
+ if (retryAttempt > 3) {
+ return Infinity
+ }
+ return 5000
+ },
onSuccess(data) {
dispatch({
type: 'SET_ROWS_COUNT',
diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index 9067a310950..4eb17c163ed 100644
--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -333,7 +333,7 @@ const SQLEditor = () => {
? project.connectionString
: databases?.find((db) => db.identifier === databaseSelectorState.selectedDatabaseId)
?.connectionString
- if (!connectionString) {
+ if (IS_PLATFORM && !connectionString) {
return toast.error('Unable to run query: Connection string is missing')
}
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
index fa1d301b47e..67435b6607a 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
@@ -109,7 +109,7 @@ const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
</pre>
))
) : (
- <p className="font-mono text-sm">{result.error.error}</p>
+ <p className="font-mono text-sm">{result.error?.message}</p>
)}
</div>
)}
diff --git a/apps/studio/pages/api/pg-meta/[ref]/query/index.ts b/apps/studio/pages/api/pg-meta/[ref]/query/index.ts
index 80a918bd5c0..c207469056c 100644
--- a/apps/studio/pages/api/pg-meta/[ref]/query/index.ts
+++ b/apps/studio/pages/api/pg-meta/[ref]/query/index.ts
@@ -25,7 +25,7 @@ const handlePost = async (req: NextApiRequest, res: NextApiResponse) => {
const response = await post(`${PG_META_URL}/query`, { query: enrichQuery(query) }, { headers })
if (response.error) {
- return res.status(400).json({ error: response.error })
+ return res.status(400).json(response.error)
} else {
return res.status(200).json(response)
}
diff --git a/apps/studio/pages/api/projects/[ref]/content.ts b/apps/studio/pages/api/projects/[ref]/content.ts
index 01206f4f68f..6345476fa57 100644
--- a/apps/studio/pages/api/projects/[ref]/content.ts
+++ b/apps/studio/pages/api/projects/[ref]/content.ts
@@ -14,8 +14,10 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
return handlePost(req, res)
case 'PATCH':
return handlePatch(req, res)
+ case 'PUT':
+ return handlePut(req, res)
default:
- res.setHeader('Allow', ['GET', 'POST', 'PATCH'])
+ res.setHeader('Allow', ['GET', 'POST', 'PATCH', 'PUT'])
res.status(405).json({ data: null, error: { message: `Method ${method} Not Allowed` } })
}
}
@@ -52,3 +54,9 @@ const handlePatch = async (req: NextApiRequest, res: NextApiResponse) => {
// Platform specific endpoint
return res.status(200).json({})
}
+
+const handlePut = async (req: NextApiRequest, res: NextApiResponse) => {
+ // Platform specific endpoint
+ const snippet: UserContent = req.body
+ return res.status(200).json({ data: snippet })
+}