Accounting: refresh reports + General Ledger after posting a journal entry

Manual journal entries post straight to the GL, but saving/deleting one
only invalidated the journal-entries list — so the Reports data (P&L /
Balance Sheet) and the General Ledger tab kept showing stale figures
until a manual refresh. Invalidate reports-data and gl-journal-entries
on save and delete too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-09 00:53:18 -04:00
parent 4b5c2ea2ea
commit d2d2c83e7b
@@ -164,6 +164,10 @@ export default function AccountingJournalEntriesPage() {
setOpen(false); setOpen(false);
resetForm(); resetForm();
qc.invalidateQueries({ queryKey: ["journal-entries", cid] }); qc.invalidateQueries({ queryKey: ["journal-entries", cid] });
// Manual JEs post straight to the GL, so refresh anything built from it:
// the Reports data (P&L / Balance Sheet) and the General Ledger tab.
qc.invalidateQueries({ queryKey: ["reports-data", cid] });
qc.invalidateQueries({ queryKey: ["gl-journal-entries", cid] });
}; };
const deleteEntry = async (id: string) => { const deleteEntry = async (id: string) => {
@@ -173,6 +177,10 @@ export default function AccountingJournalEntriesPage() {
toast.success("Journal entry deleted"); toast.success("Journal entry deleted");
if (detailId === id) setDetailId(null); if (detailId === id) setDetailId(null);
qc.invalidateQueries({ queryKey: ["journal-entries", cid] }); qc.invalidateQueries({ queryKey: ["journal-entries", cid] });
// Manual JEs post straight to the GL, so refresh anything built from it:
// the Reports data (P&L / Balance Sheet) and the General Ledger tab.
qc.invalidateQueries({ queryKey: ["reports-data", cid] });
qc.invalidateQueries({ queryKey: ["gl-journal-entries", cid] });
}; };
if (!associationId) return <p className="text-sm text-muted-foreground">Select an association.</p>; if (!associationId) return <p className="text-sm text-muted-foreground">Select an association.</p>;