@@ -13,6 +13,7 @@ import { ITreeNode } from '@/typings/tree';
1313import { useReducerContext } from '../../index' ;
1414import { workspaceActionType } from '../../context' ;
1515import i18n from '@/i18n' ;
16+ import { IConsole } from '@/typings/common'
1617interface IProps {
1718 className ?: string ;
1819}
@@ -25,7 +26,7 @@ export default memo<IProps>(function WorkspaceLeft(props) {
2526 < div className = { styles . header } >
2627 < RenderSelectDatabase />
2728 </ div >
28- < div className = { styles . save_box } > Save </ div >
29+ < RenderSaveBox > </ RenderSaveBox >
2930 < Divider />
3031 < RenderTableBox />
3132 </ div >
@@ -167,10 +168,12 @@ function RenderSelectDatabase() {
167168function RenderTableBox ( ) {
168169 const { state, dispatch } = useReducerContext ( ) ;
169170 const { currentWorkspaceData } = state ;
170- const [ initialData , setInitialData ] = useState < ITreeNode [ ] > ( ) ;
171+ const [ initialData , setInitialData ] = useState < ITreeNode [ ] > ( [ ] ) ;
171172
172173 useEffect ( ( ) => {
173- getInitialData ( ) ;
174+ if ( currentWorkspaceData . databaseName ) {
175+ getInitialData ( ) ;
176+ }
174177 } , [ currentWorkspaceData ] ) ;
175178
176179 function getInitialData ( ) {
@@ -186,13 +189,16 @@ function RenderTableBox() {
186189
187190 return (
188191 < div className = { styles . table_box } >
189- < Tree className = { styles . tree } initialData = { initialData } > </ Tree >
192+ < div className = { styles . left_box_title } > Table</ div >
193+ < LoadingContent data = { initialData } handleEmpty >
194+ < Tree className = { styles . tree } initialData = { initialData } > </ Tree >
195+ </ LoadingContent >
190196 </ div >
191197 ) ;
192198}
193199
194200function RenderSaveBox ( ) {
195- const [ savedList , setSaveList ] = useState < any > ( ) ;
201+ const [ savedList , setSaveList ] = useState < IConsole [ ] > ( [ ] ) ;
196202 const { state, dispatch } = useReducerContext ( ) ;
197203 const { currentWorkspaceData } = state ;
198204
@@ -214,8 +220,7 @@ function RenderSaveBox() {
214220 }
215221
216222 return < div className = { styles . save_box } >
217- < div > Saved</ div >
218-
223+ < div className = { styles . left_box_title } > Saved</ div >
219224 < div className = { styles . save_box_list } >
220225 < LoadingContent data = { savedList } handleEmpty >
221226 {
0 commit comments