From 0759aa4358ed3c09e48844f8abcbe97362196df4 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Sun, 19 Oct 2025 03:50:14 +0000 Subject: [PATCH] Directory: use server proxy for DevConnect reads cgen-9a1b92e63440437d80fe8d4db76dba16 --- client/pages/Directory.tsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/client/pages/Directory.tsx b/client/pages/Directory.tsx index 1aef5b22..488ae736 100644 --- a/client/pages/Directory.tsx +++ b/client/pages/Directory.tsx @@ -87,20 +87,18 @@ export default function Directory() { total_xp: u.total_xp || u.xp || null, }); - client - .from(userTable as any) - .select("*") - .limit(200) - .then(({ data, error }) => { - if (!error && Array.isArray(data)) setDevs(data.map(normalize)); - else if (client !== supabase) { - supabase - .from("user_profiles" as any) - .select("*") - .limit(200) - .then(({ data: d2 }) => setDevs((d2 || []).map(normalize))); - } - }); + if (client === devconnect) { + fetch(`/api/devconnect/rest/${userTable}?select=*&limit=200`) + .then((r) => r.json()) + .then((data) => Array.isArray(data) && setDevs(data.map(normalize))) + .catch(() => setDevs([])); + } else { + client + .from(userTable as any) + .select("*") + .limit(200) + .then(({ data }) => setDevs((data || []).map(normalize))); + } const studiosTable = client === devconnect ? "collectives" : "teams"; const mapStudio = (r: any): Studio => ({