Skip to content

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

Fix SQL Editor search not showing snippets in folders (#38308)

Joshen Lim42802af6eddf
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) => {
</span>
),
}}
+ isBranch={false}
isOpened={isOpened && !isPreview}
isSelected={isActive}
isPreview={isPreview}