broke: a private money app that runs on your own accounts and your own AI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
minimus7andClaude Opus 5.5 committed 2026-11-04 10:53:45 -06:00
commit f550865e93
359 files changed
+34290

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
"use client";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
// Opening broke syncs any bank that's due (the layout decides), in the background, once per 10 minutes per tab,
// then refreshes the page with what came in. Without a deployed webhook this is how new and older history arrives.
export function AutoSync({ due }: { due: boolean }) {
const router = useRouter();
useEffect(() => {
if (!due) return;
try {
const last = Number(sessionStorage.getItem("broke:autosync"));
if (last && Date.now() - last < 10 * 60_000) return;
sessionStorage.setItem("broke:autosync", String(Date.now()));
} catch {}
fetch("/api/plaid/sync", { method: "POST" }).then((r) => r.ok && router.refresh()).catch(() => {});
}, [due, router]);
return null;
}