mirror of
https://github.com/supabase/supabase.git
synced 2026-10-06 01:45:10 +03:00
fix: ai sidebar closing (#45932)
## TL:DR fixes ai assistant panel closing after running queries in logs and analytics ## b4: (thanks to OP) <img width="2102" height="854" alt="Image" src="https://github.com/user-attachments/assets/6a1416d8-67bf-4166-999a-d8743746efda" /> ## after: https://github.com/user-attachments/assets/bec3366b-b4d6-41c8-a287-f8c37a818f71 ## ref: - closes https://github.com/supabase/supabase/issues/45930 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved synchronization between the Logs Explorer editor and the URL/search state: running a query now updates the shared search state (and recent snippets) rather than performing a full route push, and the editor now prioritizes the URL/state value when present to prevent mismatches during navigation or query execution. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45932) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
1 parent
8935043a1b
commit
bcffb9d245
1 file changed
+7
-12
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user