Skip to content

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

fix: ai sidebar closing (#45932)

Vaibhavbcffb9d2455e
diff --git a/apps/studio/pages/project/[ref]/logs/explorer/index.tsx b/apps/studio/pages/project/[ref]/logs/explorer/index.tsx
index c29beb0b7b3..38c94f560d7 100644
--- a/apps/studio/pages/project/[ref]/logs/explorer/index.tsx
+++ b/apps/studio/pages/project/[ref]/logs/explorer/index.tsx
@@ -72,7 +72,7 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
const editorRef = useRef<editor.IStandaloneCodeEditor>()
const [editorId] = useState<string>(uuidv4())
- const { timestampStart, timestampEnd, setTimeRange } = useLogsUrlState()
+ const { search, setSearch, timestampStart, timestampEnd, setTimeRange } = useLogsUrlState()
const defaultHelper = useMemo(() => getDefaultHelper(EXPLORER_DATEPICKER_HELPERS), [])
const initialDatePickerValue = useMemo<DatePickerValue>(() => {
if (timestampStart && timestampEnd) {
@@ -217,15 +217,7 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
} else {
setTimeRange('', '')
}
- const queryParams: Record<string, string | string[] | undefined> = { ...router.query, q: query }
- if (datePickerValue.isHelper) {
- delete queryParams.its
- delete queryParams.ite
- }
- router.push({
- pathname: router.pathname,
- query: queryParams,
- })
+ setSearch(query)
addRecentLogSqlSnippet({ sql: query })
}
@@ -326,10 +318,13 @@ export const LogsExplorerPage: NextPageWithLayout = () => {
}
useEffect(() => {
- if (q) {
+ if (search) {
+ setEditorValue(search)
+ } else if (q) {
setEditorValue(q)
+ setSearch(q)
}
- }, [q])
+ }, [q, search, setSearch])
useEffect(() => {
// prevents overwriting when the user selects a helper.