diff --git a/src/routes/invoices.index.tsx b/src/routes/invoices.index.tsx index 30e9a12..238f03c 100644 --- a/src/routes/invoices.index.tsx +++ b/src/routes/invoices.index.tsx @@ -198,19 +198,7 @@ function InvoicesIndex() { toast.success(`Marked ${idArr.length} item(s) as unbilled`); } // Refetch invoices to refresh placeholder set + unbilled lists - const { data: inv } = await supabase - .from("invoices") - .select("*, client:clients(id, name), case:cases(id, case_number, title)") - .order("created_at", { ascending: false }); - setInvoices(inv ?? []); - setPlaceholderIds(new Set( - (inv ?? []) - .filter((i: any) => - typeof i.invoice_number === "string" && - (i.invoice_number.startsWith("MARKED-INVOICED-") || i.invoice_number.startsWith("IMPORT-PREBILLED-")) - ) - .map((i: any) => i.id), - )); + await fetchInvoices(); await loadUnbilled(); if (table === "time_entries") setSelectedTime(new Set()); else setSelectedExp(new Set()); } catch (err: any) { @@ -221,19 +209,7 @@ function InvoicesIndex() { }; const refreshInvoices = async () => { - const { data } = await supabase - .from("invoices") - .select("*, client:clients(id, name), case:cases(id, case_number, title)") - .order("created_at", { ascending: false }); - setInvoices(data ?? []); - setPlaceholderIds(new Set( - (data ?? []) - .filter((i: any) => - typeof i.invoice_number === "string" && - (i.invoice_number.startsWith("MARKED-INVOICED-") || i.invoice_number.startsWith("IMPORT-PREBILLED-")) - ) - .map((i: any) => i.id), - )); + await fetchInvoices(); }; const bulkInvoiceAction = async (action: "delete" | "sent" | "void") => {