From 6faff88438ee254b94b2c50a37334d2a04953f59 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 22:59:54 +0000 Subject: [PATCH 1/2] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- ...47_8d9ead74-700d-417e-b6f2-bfcbbe9799cb.sql | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 supabase/migrations/20260419225947_8d9ead74-700d-417e-b6f2-bfcbbe9799cb.sql diff --git a/supabase/migrations/20260419225947_8d9ead74-700d-417e-b6f2-bfcbbe9799cb.sql b/supabase/migrations/20260419225947_8d9ead74-700d-417e-b6f2-bfcbbe9799cb.sql new file mode 100644 index 0000000..ec4b9ea --- /dev/null +++ b/supabase/migrations/20260419225947_8d9ead74-700d-417e-b6f2-bfcbbe9799cb.sql @@ -0,0 +1,18 @@ +-- Delete the 7,953 placeholder clients created by the bad invoice import. +-- These are archived, have numeric external_id (e.g. "10008057"), and have +-- no linked cases, invoices, homeowners, contacts, or field values. +DELETE FROM public.client_field_values + WHERE client_id IN ( + SELECT id FROM public.clients + WHERE archived_at IS NOT NULL AND external_id ~ '^[0-9]+$' + ); + +DELETE FROM public.client_contacts + WHERE client_id IN ( + SELECT id FROM public.clients + WHERE archived_at IS NOT NULL AND external_id ~ '^[0-9]+$' + ); + +DELETE FROM public.clients + WHERE archived_at IS NOT NULL + AND external_id ~ '^[0-9]+$'; \ No newline at end of file From e6c16af364aee2c1154895ed4b01bebe2b92b337 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 23:00:04 +0000 Subject: [PATCH 2/2] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/clients.index.tsx | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/routes/clients.index.tsx b/src/routes/clients.index.tsx index b945d3c..299dab8 100644 --- a/src/routes/clients.index.tsx +++ b/src/routes/clients.index.tsx @@ -35,11 +35,25 @@ function ClientsList() { const [busy, setBusy] = useState(false); const load = async () => { - const [{ data: cli }, { data: usr }] = await Promise.all([ - supabase.from("clients").select("*").order("name", { ascending: true }), - supabase.from("profiles").select("id, full_name, email").order("full_name", { ascending: true }), - ]); - setClients(cli ?? []); + // Page through clients so we never silently hit Supabase's 1000-row cap. + const pageSize = 1000; + const all: any[] = []; + for (let from = 0; ; from += pageSize) { + const { data, error } = await supabase + .from("clients") + .select("*") + .order("name", { ascending: true }) + .range(from, from + pageSize - 1); + if (error) { toast.error(error.message); break; } + const batch = data ?? []; + all.push(...batch); + if (batch.length < pageSize) break; + } + const { data: usr } = await supabase + .from("profiles") + .select("id, full_name, email") + .order("full_name", { ascending: true }); + setClients(all); setUsers(usr ?? []); };