Skip to content

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

Logs explorer save query to recent queries when selecting a template from dropdown

Joshen Lim7ed793ff5bd5
diff --git a/studio/components/interfaces/Settings/Logs/LogSelection.tsx b/studio/components/interfaces/Settings/Logs/LogSelection.tsx
index 8f02d8b09b9..01cc5473042 100644
--- a/studio/components/interfaces/Settings/Logs/LogSelection.tsx
+++ b/studio/components/interfaces/Settings/Logs/LogSelection.tsx
@@ -1,19 +1,15 @@
import { FC } from 'react'
-import { IconX, Loading } from 'ui'
+import { IconX } from 'ui'
import { LogData, QueryType } from './Logs.types'
-import DatabaseApiSelectionRender, {
- DatabaseApiSelectionHeaderRender,
-} from './LogSelectionRenderers/DatabaseApiSelectionRender'
+import DatabaseApiSelectionRender from './LogSelectionRenderers/DatabaseApiSelectionRender'
import DatabasePostgresSelectionRender from './LogSelectionRenderers/DatabasePostgresSelectionRender'
-import FunctionInvocationSelectionRender, {
- FunctionInvocationHeaderRender,
-} from './LogSelectionRenderers/FunctionInvocationSelectionRender'
+import FunctionInvocationSelectionRender from './LogSelectionRenderers/FunctionInvocationSelectionRender'
import FunctionLogsSelectionRender from './LogSelectionRenderers/FunctionLogsSelectionRender'
import DefaultExplorerSelectionRenderer from './LogSelectionRenderers/DefaultExplorerSelectionRenderer'
import DefaultPreviewSelectionRenderer from './LogSelectionRenderers/DefaultPreviewSelectionRenderer'
-import { isDefaultLogPreviewFormat, LogsEndpointParams, LogsTableName } from '.'
+import { isDefaultLogPreviewFormat, LogsEndpointParams } from '.'
import useSingleLog from 'hooks/analytics/useSingleLog'
import Connecting from 'components/ui/Loading/Loading'
diff --git a/studio/pages/project/[ref]/logs-explorer/index.tsx b/studio/pages/project/[ref]/logs-explorer/index.tsx
index 573c6840730..e4db358c99a 100644
--- a/studio/pages/project/[ref]/logs-explorer/index.tsx
+++ b/studio/pages/project/[ref]/logs-explorer/index.tsx
@@ -73,6 +73,9 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
pathname: router.pathname,
query: { ...router.query, q: template.searchString },
})
+ content.addRecentLogSqlSnippet({
+ sql: template.searchString,
+ })
}
const handleRun = (value?: string | React.MouseEvent<HTMLButtonElement>) => {
diff --git a/studio/pages/project/[ref]/logs-explorer/recent.tsx b/studio/pages/project/[ref]/logs-explorer/recent.tsx
index 48eb03ca5c4..8edc8ffad66 100644
--- a/studio/pages/project/[ref]/logs-explorer/recent.tsx
+++ b/studio/pages/project/[ref]/logs-explorer/recent.tsx
@@ -1,8 +1,8 @@
-import React, { useEffect } from 'react'
+import { useEffect } from 'react'
import Link from 'next/link'
import { observer } from 'mobx-react-lite'
-import { Button, IconClock, IconSave, Loading } from 'ui'
-import { useStore, withAuth } from 'hooks'
+import { Button, IconClock } from 'ui'
+import { useStore } from 'hooks'
import RecentQueriesItem from 'components/interfaces/Settings/Logs/RecentQueriesItem'
import LogsExplorerLayout from 'components/layouts/LogsExplorerLayout/LogsExplorerLayout'