Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 03:29:50 +00:00
co-authored by renee-png
parent d69ab40bc8
commit 451b1a21d0
+12
View File
@@ -516,6 +516,8 @@ interface ImportResult {
function ImportPage() {
const { user } = useAuth();
const [results, setResults] = useState<Record<string, ImportResult | "running">>({});
const [clientList, setClientList] = useState<{ id: string; name: string }[]>([]);
const [defaultClientId, setDefaultClientId] = useState<string>("");
const ctx = useMemo<ImportCtx>(() => ({
userId: user?.id ?? "",
clientByExt: new Map(),
@@ -525,8 +527,18 @@ function ImportPage() {
invoiceByExt: new Map(),
clientByName: new Map(),
caseByNumber: new Map(),
defaultClientId: null,
}), [user?.id]);
useEffect(() => {
void supabase
.from("clients")
.select("id,name")
.is("archived_at", null)
.order("name")
.then(({ data }) => setClientList((data ?? []) as { id: string; name: string }[]));
}, []);
// Pre-load lookup caches from existing rows so subsequent imports can join.
// Always reload (and paginate past Supabase's 1000-row default limit) so caches
// pick up rows added since the page mounted (e.g., from a prior CSV import).