Skip to content

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

Merge branch 'master' into feat/studio-logs-page-query-params

TzeYiingbe52adde95f3
diff --cc studio/pages/project/[ref]/settings/logs/[type].tsx
index 295e18d782b,cfc8a60eb2c..6fbe0dba3d8
--- a/studio/pages/project/[ref]/settings/logs/[type].tsx
+++ b/studio/pages/project/[ref]/settings/logs/[type].tsx
@@@ -180,28 -154,12 +180,30 @@@ export const LogPage: NextPage = () =>
...prev,
where: isSelectQuery ? '' : editorValue,
sql: isSelectQuery ? editorValue : '',
+ search_query: ''
}))
+ if (!logsQueryParamsSyncing) return
+ router.push({
+ pathname: router.pathname,
+ query: {
+ ...router.query,
+ q: editorValue,
+ s: undefined,
+ },
+ })
}
const handleSearch = (v: string) => {
- setParams((prev) => ({ ...prev, search_query: v || '' }))
+ setParams((prev) => ({ ...prev, search_query: v || '', where: '', sql: '' }))
+ if (!logsQueryParamsSyncing) return
+ router.push({
+ pathname: router.pathname,
+ query: {
+ ...router.query,
+ q: undefined,
+ s: v || '',
+ },
+ })
+ setEditorValue('')
}
return (
diff --cc studio/tests/pages/projects/logs.test.js
index a5ef1f9f42e,52b60044c01..5ed73bab47f
--- a/studio/tests/pages/projects/logs.test.js
+++ b/studio/tests/pages/projects/logs.test.js
@@@ -219,16 -210,8 +225,19 @@@ test('where clause will trigger a log r
() => {
expect(get).toHaveBeenCalledWith(expect.stringContaining('where'))
expect(get).toHaveBeenCalledWith(expect.stringContaining('metadata.field'))
+
+ // updates router query params
+ expect(router.push).toHaveBeenCalledWith(
+ expect.objectContaining({
+ pathname: expect.any(String),
+ query: expect.objectContaining({
+ q: expect.stringContaining('something'),
+ }),
+ })
+ )
++
+ // should ignore search bar value
+ expect(get).not.toHaveBeenCalledWith(expect.stringContaining('search_value'))
},
{ timeout: 1000 }
)