@@ -63,43 +63,17 @@ const StorageExplorer = ({ bucket }: StorageExplorerProps) => {
6363 const currentFolderIdx = openedFolders . length - 1
6464 const currentFolder = openedFolders [ currentFolderIdx ]
6565
66- if ( itemSearchString ) {
67- if ( ! currentFolder ) {
68- // At root of bucket
69- await fetchFolderContents ( {
70- bucketId : bucket . id ,
71- folderId : bucket . id ,
72- folderName : bucket . name ,
73- index : - 1 ,
74- searchString : itemSearchString ,
75- } )
76- } else {
77- await fetchFolderContents ( {
78- bucketId : bucket . id ,
79- folderId : currentFolder . id ,
80- folderName : currentFolder . name ,
81- index : currentFolderIdx ,
82- searchString : itemSearchString ,
83- } )
84- }
85- } else {
86- if ( ! currentFolder ) {
87- // At root of bucket
88- await fetchFolderContents ( {
89- bucketId : bucket . id ,
90- folderId : bucket . id ,
91- folderName : bucket . name ,
92- index : - 1 ,
93- } )
94- } else {
95- await fetchFolderContents ( {
96- bucketId : bucket . id ,
97- folderId : currentFolder . id ,
98- folderName : currentFolder . name ,
99- index : currentFolderIdx ,
100- } )
101- }
102- }
66+ const folderId = ! currentFolder ? bucket . id : currentFolder . id
67+ const folderName = ! currentFolder ? bucket . name : currentFolder . name
68+ const index = ! currentFolder ? - 1 : currentFolderIdx
69+
70+ await fetchFolderContents ( {
71+ bucketId : bucket . id ,
72+ folderId,
73+ folderName,
74+ index,
75+ searchString : itemSearchString ,
76+ } )
10377 } else if ( view === STORAGE_VIEWS . COLUMNS ) {
10478 if ( openedFolders . length > 0 ) {
10579 const paths = openedFolders . map ( ( folder ) => folder . name )
@@ -110,6 +84,7 @@ const StorageExplorer = ({ bucket }: StorageExplorerProps) => {
11084 folderId : bucket . id ,
11185 folderName : bucket . name ,
11286 index : - 1 ,
87+ searchString : itemSearchString ,
11388 } )
11489 }
11590 }
0 commit comments