Skip to content

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

Fix deleting a query thats not saved throwing an error (#21082)

Joshen Lim8841a46dce86
diff --git a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index dd40acf22c3..53b9bfca647 100644
--- a/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -607,7 +607,7 @@ const SQLEditor = () => {
<AiIconAnimation loading={isAiLoading} />
</motion.div>
- <AnimatePresence initial={false} exitBeforeEnter>
+ <AnimatePresence initial={false} mode="wait">
{debugSolution && (
<div className="h-full w-full flex flex-row items-center overflow-y-hidden text-sm text-white">
{debugSolution}
diff --git a/apps/studio/components/layouts/SQLEditorLayout/QueryItem.tsx b/apps/studio/components/layouts/SQLEditorLayout/QueryItem.tsx
index df50924b80d..3f5cb817baf 100644
--- a/apps/studio/components/layouts/SQLEditorLayout/QueryItem.tsx
+++ b/apps/studio/components/layouts/SQLEditorLayout/QueryItem.tsx
@@ -69,7 +69,8 @@ const QueryItem = ({
const { mutate: deleteContent, isLoading: isDeleting } = useContentDeleteMutation({
onSuccess: (data) => onDeleteQuery(data),
onError: (error, data) => {
- if (error.code === 404 && error.message.includes('Content not found')) {
+ console.log({ error })
+ if (error.message.includes('Contents not found')) {
onDeleteQuery(data.ids)
} else {
toast.error(`Failed to delete query: ${error.message}`)