From 82291b737f1ff0cda57b49044b9a178b1a82b067 Mon Sep 17 00:00:00 2001 From: Gildas Garcia <1122076+djhi@users.noreply.github.com> Date: Fri, 2 Oct 2026 11:32:47 +0200 Subject: [PATCH] Improve refetch logic --- apps/studio/state/storage-explorer.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/studio/state/storage-explorer.tsx b/apps/studio/state/storage-explorer.tsx index f038ccaa5a1..4fc99bb8201 100644 --- a/apps/studio/state/storage-explorer.tsx +++ b/apps/studio/state/storage-explorer.tsx @@ -419,15 +419,21 @@ export function createStorageExplorerState({ }, refetchAllOpenedFolders: async () => { - if (state.itemSearchString) { - const paths = state.openedFolders.map((folder) => folder.name) - await state.fetchFoldersByPath({ paths: paths.slice(0, -1) }) - await state.fetchFoldersByPath({ - paths: [paths[paths.length - 1]], + const paths = state.openedFolders.map((folder) => folder.name) + + if (state.itemSearchString && paths.length === 0) { + await state.fetchFoldersByPath({ paths, searchString: state.itemSearchString }) + } else if (state.itemSearchString) { + await state.fetchFoldersByPath({ paths }) + // Reapply the filter to the current column only. + await state.fetchFolderContents({ + bucketId: state.selectedBucket.id, + folderId: state.openedFolders[paths.length - 1].id, + folderName: paths[paths.length - 1], + index: paths.length - 1, searchString: state.itemSearchString, }) } else { - const paths = state.openedFolders.map((folder) => folder.name) await state.fetchFoldersByPath({ paths }) } },