Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix storage explorer search (#36561)

Terry Suttonf4222eb93fd1
diff --git a/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.tsx b/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.tsx
index e9a20a5e1bd..a268b1aaeff 100644
--- a/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.tsx
+++ b/apps/studio/components/to-be-cleaned/Storage/StorageExplorer/StorageExplorer.tsx
@@ -63,43 +63,17 @@ const StorageExplorer = ({ bucket }: StorageExplorerProps) => {
const currentFolderIdx = openedFolders.length - 1
const currentFolder = openedFolders[currentFolderIdx]
- if (itemSearchString) {
- if (!currentFolder) {
- // At root of bucket
- await fetchFolderContents({
- bucketId: bucket.id,
- folderId: bucket.id,
- folderName: bucket.name,
- index: -1,
- searchString: itemSearchString,
- })
- } else {
- await fetchFolderContents({
- bucketId: bucket.id,
- folderId: currentFolder.id,
- folderName: currentFolder.name,
- index: currentFolderIdx,
- searchString: itemSearchString,
- })
- }
- } else {
- if (!currentFolder) {
- // At root of bucket
- await fetchFolderContents({
- bucketId: bucket.id,
- folderId: bucket.id,
- folderName: bucket.name,
- index: -1,
- })
- } else {
- await fetchFolderContents({
- bucketId: bucket.id,
- folderId: currentFolder.id,
- folderName: currentFolder.name,
- index: currentFolderIdx,
- })
- }
- }
+ const folderId = !currentFolder ? bucket.id : currentFolder.id
+ const folderName = !currentFolder ? bucket.name : currentFolder.name
+ const index = !currentFolder ? -1 : currentFolderIdx
+
+ await fetchFolderContents({
+ bucketId: bucket.id,
+ folderId,
+ folderName,
+ index,
+ searchString: itemSearchString,
+ })
} else if (view === STORAGE_VIEWS.COLUMNS) {
if (openedFolders.length > 0) {
const paths = openedFolders.map((folder) => folder.name)
@@ -110,6 +84,7 @@ const StorageExplorer = ({ bucket }: StorageExplorerProps) => {
folderId: bucket.id,
folderName: bucket.name,
index: -1,
+ searchString: itemSearchString,
})
}
}