@@ -113,28 +113,26 @@ const App: React.FC = () => {
113113 } , [ editors . flushAllPendingChanges ] ) ;
114114
115115 useEffect ( ( ) => {
116+ if ( ! editors . activeFileId ) {
117+ return ;
118+ }
119+
116120 fileTree . setActiveNode ( editors . activeFileId ) ;
117121 } , [ editors . activeFileId , fileTree . setActiveNode ] ) ;
118122
119123 useEffect ( ( ) => {
120124 if ( ! editors . activeFileId ) {
121- fileTree . clearFileSelection ( ) ;
122125 return ;
123126 }
124127
125128 const node = fileTree . findNodeByPath ( fileTree . fileTree , editors . activeFileId ) ;
126- if ( ! node ) {
127- fileTree . clearFileSelection ( ) ;
128- return ;
129- }
130-
131- if ( node . isSelected ) {
129+ if ( ! node || node . isSelected ) {
132130 return ;
133131 }
134132
135133 fileTree . selectNode ( node . id ) ;
136134 } , [ editors . activeFileId , fileTree . fileTree ,
137- fileTree . findNodeByPath , fileTree . selectNode , fileTree . clearFileSelection ] ) ;
135+ fileTree . findNodeByPath , fileTree . selectNode ] ) ;
138136
139137 useEffect ( ( ) => {
140138 saveItem ( 'terminals' , terminals . terminals ) ;
@@ -160,7 +158,6 @@ const App: React.FC = () => {
160158 const handleSelectFile = useEvent ( ( fileId : string ) => {
161159 const paneId = resolveEditorPaneId ( ) ;
162160 if ( ! paneId ) return ;
163- if ( editors . activeFileId === fileId ) return ;
164161 editors . setActiveFileId ( fileId , paneId ) ;
165162 } ) ;
166163
0 commit comments