@@ -71,7 +71,7 @@ const Explorer = ({
7171 } , [ selectedEntry ] ) ;
7272
7373 useEffect ( ( ) => {
74- subscribe ( `updateExplorer-${ api . name } ` , fetchFileList ) ;
74+ subscribe ( `updateExplorer-${ api . name } ` , fetchFileListCallback ) ;
7575
7676 return ( ) => {
7777 unsubscribe ( `updateExplorer-${ api . name } ` , ( ) => { } ) ;
@@ -97,7 +97,12 @@ const Explorer = ({
9797 }
9898 } ;
9999
100- const fetchFileList = async ( ) => {
100+ const fetchFileListCallback = async ( e : any ) => {
101+ const project = e . detail . project ;
102+ await fetchFileList ( project !== undefined ? project : "" ) ;
103+ } ;
104+
105+ const fetchFileList = async ( project : string ) => {
101106 console . log ( "Fecthing file list, the project name is:" , project ) ;
102107 if ( project !== "" ) {
103108 try {
@@ -152,7 +157,7 @@ const Explorer = ({
152157 if ( name !== "" ) {
153158 try {
154159 await api . file . create ( project , location , name ) ;
155- fetchFileList ( ) ; // Update the file list
160+ fetchFileList ( project ) ; // Update the file list
156161 } catch ( e ) {
157162 if ( e instanceof Error ) {
158163 console . error ( "Error creating file:" , e ) ;
@@ -191,7 +196,7 @@ const Explorer = ({
191196 await api . file . delete ( project , deleteEntry . path ) ;
192197 }
193198
194- fetchFileList ( ) ; // Update the file list
199+ fetchFileList ( project ) ; // Update the file list
195200
196201 if ( currentFile === deleteEntry ) {
197202 setCurrentFile ( undefined ) ; // Unset the current file
@@ -245,7 +250,7 @@ const Explorer = ({
245250 if ( folder_name !== "" ) {
246251 try {
247252 await api . folder . create ( project , folder_name , location ) ;
248- fetchFileList ( ) ; // Update the file list
253+ fetchFileList ( project ) ; // Update the file list
249254 } catch ( e ) {
250255 if ( e instanceof Error ) {
251256 console . error ( "Error creating folder:" , e . message ) ;
@@ -284,7 +289,7 @@ const Explorer = ({
284289 await api . file . rename ( project , renameEntry . path , new_path ) ;
285290 }
286291
287- fetchFileList ( ) ; // Update the file list
292+ fetchFileList ( project ) ; // Update the file list
288293
289294 if ( currentFile && currentFile . path === renameEntry . path ) {
290295 currentFile . path = new_path ;
@@ -321,7 +326,7 @@ const Explorer = ({
321326
322327 const handleCloseUploadModal = ( ) => {
323328 setUploadModalOpen ( false ) ;
324- fetchFileList ( ) ;
329+ fetchFileList ( project ) ;
325330 } ;
326331
327332 ///////////////// DOWNLOAD ///////////////////////////////////////////////////
@@ -399,7 +404,7 @@ const Explorer = ({
399404 </ MenuButtonStroke >
400405 < MenuButtonStroke
401406 id = "refresh-explorer-button"
402- onClick = { ( ) => fetchFileList ( ) }
407+ onClick = { ( ) => fetchFileList ( project ) }
403408 title = "Refresh View"
404409 >
405410 < ResetIcon viewBox = "0 0 20 20" />
@@ -444,7 +449,7 @@ const Explorer = ({
444449 isOpen = { isNewFileModalOpen }
445450 onSubmit = { ( project : string , location : string , ...args : any [ ] ) => {
446451 api . modals ! . createFile ! . onCreate ( project , location , ...args ) ;
447- fetchFileList ( ) ;
452+ fetchFileList ( project ) ;
448453 } }
449454 onClose = { handleCloseNewFileModal }
450455 fileList = { fileList }
0 commit comments