Skip to content

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

added logsQueryParamsSyncing feature flag

TzeYiinge2437249a4af
diff --git a/studio/pages/project/[ref]/settings/logs/[type].tsx b/studio/pages/project/[ref]/settings/logs/[type].tsx
index e8e43198df1..5fc32f7218f 100644
--- a/studio/pages/project/[ref]/settings/logs/[type].tsx
+++ b/studio/pages/project/[ref]/settings/logs/[type].tsx
@@ -23,6 +23,7 @@ import { uuidv4 } from 'lib/helpers'
import useSWRInfinite from 'swr/infinite'
import { isUndefined } from 'lodash'
import Flag from 'components/ui/Flag/Flag'
+import { useFlag } from 'hooks'
/**
* Acts as a container component for the entire log display
@@ -36,6 +37,7 @@ import Flag from 'components/ui/Flag/Flag'
* - `ts` for timestamp start value.
*/
export const LogPage: NextPage = () => {
+ const logsQueryParamsSyncing = useFlag('logsQueryParamsSyncing')
const router = useRouter()
const { ref, type, q, s, ts } = router.query
const [editorId, setEditorId] = useState<string>(uuidv4())
@@ -56,6 +58,7 @@ export const LogPage: NextPage = () => {
}, [type])
useEffect(() => {
+ if (!logsQueryParamsSyncing) return
// on mount, set initial values
if (q) {
onSelectTemplate({
@@ -159,6 +162,7 @@ export const LogPage: NextPage = () => {
}
const handleEditorSubmit = () => {
setParams((prev) => ({ ...prev, where: editorValue }))
+ if (!logsQueryParamsSyncing) return
router.push({
pathname: router.pathname,
query: {
@@ -169,7 +173,7 @@ export const LogPage: NextPage = () => {
}
const handleSearch = (v: string) => {
setParams((prev) => ({ ...prev, search_query: v || '' }))
-
+ if (!logsQueryParamsSyncing) return
router.push({
pathname: router.pathname,
query: {
diff --git a/studio/tests/pages/projects/logs.test.js b/studio/tests/pages/projects/logs.test.js
index 15879dd78f3..71343433cbb 100644
--- a/studio/tests/pages/projects/logs.test.js
+++ b/studio/tests/pages/projects/logs.test.js
@@ -32,9 +32,13 @@ Editor.mockImplementation((props) => {
})
useMonaco.mockImplementation((v) => v)
+// mock usage flags
jest.mock('components/ui/Flag/Flag')
import Flag from 'components/ui/Flag/Flag'
Flag.mockImplementation(({ children }) => <>{children}</>)
+jest.mock('hooks')
+import {useFlag} from 'hooks'
+useFlag.mockReturnValue(true)
import { SWRConfig } from 'swr'
jest.mock('pages/project/[ref]/settings/logs/[type]')