From 42802af6eddf663ca52f2ae0512489baa7eae2ff Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Mon, 1 Sep 2025 14:51:03 +0700 Subject: [PATCH] Fix SQL Editor search not showing snippets in folders (#38308) --- .../layouts/SQLEditorLayout/SQLEditorNavV2/SearchList.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorNavV2/SearchList.tsx b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorNavV2/SearchList.tsx index 3faee123796..1f6020cd8ef 100644 --- a/apps/studio/components/layouts/SQLEditorLayout/SQLEditorNavV2/SearchList.tsx +++ b/apps/studio/components/layouts/SQLEditorLayout/SQLEditorNavV2/SearchList.tsx @@ -53,7 +53,11 @@ export const SearchList = ({ search }: SearchListProps) => { ) const totalNumber = (count as unknown as { count: number })?.count ?? 0 - const snippets = useMemo(() => data?.pages.flatMap((page) => page.content), [data?.pages]) + const snippets = useMemo( + // [Joshen] Set folder_id to null to ensure flat list + () => data?.pages.flatMap((page) => page.content.map((x) => ({ ...x, folder_id: null }))), + [data?.pages] + ) const treeState = formatFolderResponseForTreeView({ folders: [], contents: snippets as any }) const snippetsLastItemIds = useMemo(() => getLastItemIds(treeState), [treeState]) @@ -117,6 +121,7 @@ export const SearchList = ({ search }: SearchListProps) => { ), }} + isBranch={false} isOpened={isOpened && !isPreview} isSelected={isActive} isPreview={isPreview}