@@ -133,8 +133,6 @@ function Console(props: IProps, ref: ForwardedRef<IConsoleRef>) {
133133 editorRef : editorRef ?. current ,
134134 } ) ) ;
135135
136- useEffect ( ( ) => { } , [ ] ) ;
137-
138136 useEffect ( ( ) => {
139137 if ( source !== 'workspace' ) {
140138 return ;
@@ -151,20 +149,20 @@ function Console(props: IProps, ref: ForwardedRef<IConsoleRef>) {
151149 } else {
152150 // 活跃时自动保存
153151 indexedDB
154- . getDataByCursor ( 'chat2db' , 'workspaceConsoleDDL' , {
155- consoleId : executeParams . consoleId ! ,
156- userId : getCookie ( 'CHAT2DB.USER_ID' ) ,
157- } )
158- . then ( ( res : any ) => {
159- const value = defaultValue || res ?. [ 0 ] ?. ddl || '' ;
160- const oldValue = editorRef ?. current ?. getAllContent ( ) ;
161- if ( value !== oldValue ) {
162- editorRef ?. current ?. setValue ( value , 'reset' ) ;
163- }
164- setTimeout ( ( ) => {
165- timingAutoSave ( ) ;
166- } , 0 ) ;
167- } ) ;
152+ . getDataByCursor ( 'chat2db' , 'workspaceConsoleDDL' , {
153+ consoleId : executeParams . consoleId ! ,
154+ userId : getCookie ( 'CHAT2DB.USER_ID' ) ,
155+ } )
156+ . then ( ( res : any ) => {
157+ const value = defaultValue || res ?. [ 0 ] ?. ddl || '' ;
158+ const oldValue = editorRef ?. current ?. getAllContent ( ) ;
159+ if ( value !== oldValue ) {
160+ editorRef ?. current ?. setValue ( value , 'reset' ) ;
161+ }
162+ setTimeout ( ( ) => {
163+ timingAutoSave ( ) ;
164+ } , 0 ) ;
165+ } ) ;
168166 }
169167 return ( ) => {
170168 if ( timerRef . current ) {
@@ -178,13 +176,13 @@ function Console(props: IProps, ref: ForwardedRef<IConsoleRef>) {
178176 clearInterval ( timerRef . current ) ;
179177 }
180178 timerRef . current = setInterval ( ( ) => {
181- if ( executeParams . status === ConsoleStatus . RELEASE || status === ConsoleStatus . RELEASE ) {
179+ if ( executeParams . status === ConsoleStatus . RELEASE || status === ConsoleStatus . RELEASE ) {
182180 const p : any = {
183181 id : executeParams . consoleId ,
184182 ddl : editorRef ?. current ?. getAllContent ( ) ,
185183 } ;
186- historyServer . updateSavedConsole ( p )
187- } else {
184+ historyServer . updateSavedConsole ( p ) ;
185+ } else {
188186 indexedDB . updateData ( 'chat2db' , 'workspaceConsoleDDL' , {
189187 consoleId : executeParams . consoleId ! ,
190188 ddl : editorRef ?. current ?. getAllContent ( ) ,
@@ -459,10 +457,10 @@ function Console(props: IProps, ref: ForwardedRef<IConsoleRef>) {
459457 } ;
460458
461459 const handleSelectTableSyncModel = ( ) => {
462- const syncModel : SyncModelType | null = Number ( localStorage . getItem ( 'syncTableModel' ) ) ?? null ;
460+ const syncModel = localStorage . getItem ( 'syncTableModel' ) ;
463461 const hasAiAccess = aiModel . hasWhite ;
464462 if ( syncModel !== null ) {
465- setSyncTableModel ( syncModel ) ;
463+ setSyncTableModel ( Number ( syncModel ) ) ;
466464 return ;
467465 }
468466
0 commit comments