Skip to content

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

fix: fixed saved log queries logic, no longer showing other content types

TzeYiing8c272d7f9485
diff --git a/studio/components/interfaces/Settings/Logs/Logs.SavedQueriesItem.tsx b/studio/components/interfaces/Settings/Logs/Logs.SavedQueriesItem.tsx
index fed7ea84ebb..7d34197d008 100644
--- a/studio/components/interfaces/Settings/Logs/Logs.SavedQueriesItem.tsx
+++ b/studio/components/interfaces/Settings/Logs/Logs.SavedQueriesItem.tsx
@@ -2,7 +2,6 @@ import dayjs from 'dayjs'
import { FC, useState } from 'react'
import { Button, IconChevronRight, IconMaximize2, IconPlay } from '@supabase/ui'
import Table from 'components/to-be-cleaned/Table'
-import CodeEditor from 'components/ui/CodeEditor'
import { useRouter } from 'next/router'
interface Props {
diff --git a/studio/components/layouts/LogsExplorerLayout/LogsExplorerLayout.tsx b/studio/components/layouts/LogsExplorerLayout/LogsExplorerLayout.tsx
index 58571839c1b..7a0383f464d 100644
--- a/studio/components/layouts/LogsExplorerLayout/LogsExplorerLayout.tsx
+++ b/studio/components/layouts/LogsExplorerLayout/LogsExplorerLayout.tsx
@@ -21,7 +21,7 @@ const PageLayout = ({
if (!content.isLoaded) {
return (
<BaseLayout>
- <Loading active={true}>loading</Loading>
+ <Loading active={true}>{null}</Loading>
</BaseLayout>
)
}
diff --git a/studio/pages/project/[ref]/logs-explorer/saved.tsx b/studio/pages/project/[ref]/logs-explorer/saved.tsx
index 642ae52ba7d..2f9a59cdca0 100644
--- a/studio/pages/project/[ref]/logs-explorer/saved.tsx
+++ b/studio/pages/project/[ref]/logs-explorer/saved.tsx
@@ -9,29 +9,33 @@ import LogsExplorerLayout from 'components/layouts/LogsExplorerLayout/LogsExplor
import Table from 'components/to-be-cleaned/Table'
import { useRouter } from 'next/router'
+import { UserContent } from 'types'
-export const LogsExplorerPage: NextPage = () => {
+export const LogsSavedPage: NextPage = () => {
const { content, ui } = useStore()
const router = useRouter()
const { ref } = router.query
useEffect(() => {
- content.load()
+ if (!content.isLoading) {
+ content.load()
+ }
}, [ui.selectedProject])
- if (content.isLoaded)
+ const contentList = content.list()
+ if (content.isLoading) {
return (
<LogsExplorerLayout>
- <Loading active={true}>loading</Loading>
+ <Loading active={true}>{null}</Loading>
</LogsExplorerLayout>
)
+ }
- const saved = content.list()
-
+ const saved: UserContent[] = (contentList?.[0] || []).filter((content: UserContent)=> content.type === 'log_sql')
return (
<LogsExplorerLayout>
<div className="flex flex-col gap-3">
- {saved[0].length > 0 && (
+ {saved.length > 0 && (
<Table
headTrClasses="expandable-tr"
head={
@@ -44,13 +48,15 @@ export const LogsExplorerPage: NextPage = () => {
</>
}
body={
- saved.length > 0 &&
- saved[0].map((item: any) => <LogsSavedQueriesItem key={item.id} item={item} />)
+ <>
+ {saved.length > 0 &&
+ saved.map((item: any) => <LogsSavedQueriesItem key={item.id} item={item} />)}
+ </>
}
/>
)}
</div>
- {saved[0].length === 0 && (
+ {saved.length === 0 && (
<>
<div className="items-center flex flex-col gap-1 my-auto justify-center h-full flex-grow">
<IconSave className="animate-bounce" />
@@ -69,4 +75,4 @@ export const LogsExplorerPage: NextPage = () => {
)
}
-export default withAuth(observer(LogsExplorerPage))
+export default withAuth(observer(LogsSavedPage))