@@ -3,7 +3,6 @@ import { useRoute, useRouter } from 'vue-router'
33const useQueryUrlSync = ( { builderFormState, textEditorState, timeRange, editorType, urlParams = { } as any } ) => {
44 const route = useRoute ( )
55 const router = useRouter ( )
6- const hasInitParams = ref ( false )
76 function initializeFromQuery ( ) {
87 const {
98 [ urlParams . editorType || 'editorType' ] : queryEditorType ,
@@ -27,21 +26,20 @@ const useQueryUrlSync = ({ builderFormState, textEditorState, timeRange, editorT
2726 }
2827 if ( queryTimeRange && Array . isArray ( queryTimeRange ) ) {
2928 timeRange . rangeTime . value = queryTimeRange as string [ ]
29+ timeRange . time . value = 0
3030 }
3131
3232 // Editor SQL
3333 if ( queryEditorSql ) {
3434 textEditorState . sql = decodeURIComponent ( queryEditorSql as string )
35- hasInitParams . value = true
3635 }
3736
3837 // Builder form state
3938 if ( queryBuilderForm ) {
4039 try {
41- Object . assign ( builderFormState , JSON . parse ( decodeURIComponent ( queryBuilderForm as string ) ) )
42- if ( builderFormState . table && builderFormState . tsColumn ) {
43- hasInitParams . value = true
44- }
40+ const paramsObj = JSON . parse ( decodeURIComponent ( queryBuilderForm as string ) )
41+ delete paramsObj . tsColumn
42+ Object . assign ( builderFormState , paramsObj )
4543 } catch ( error ) {
4644 console . warn ( 'Failed to parse builder form state from URL:' , error )
4745 }
@@ -78,7 +76,6 @@ const useQueryUrlSync = ({ builderFormState, textEditorState, timeRange, editorT
7876 return {
7977 initializeFromQuery,
8078 updateQueryParams,
81- hasInitParams,
8279 }
8380}
8481
0 commit comments