Fix race condition in income statement report view

This commit is contained in:
RunasSudo 2025-02-15 22:54:59 +11:00
parent 12f1c85a81
commit 156a89e2ba
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -90,6 +90,13 @@
dtStart.value = dayjs(db.metadata.eofy_date).subtract(1, 'year').add(1, 'day').format('YYYY-MM-DD');
await updateReport(session);
// Update report when dates etc. changed
// We initialise the watcher here only after dt and dtStart are initialised above
watch([dt, dtStart], async () => {
const session = await db.load();
await updateReport(session);
});
}
async function updateReport(session: ExtendedDatabase) {
@ -99,11 +106,5 @@
report.value = reportingWorkflow.getReportAtStage(ReportingStage.InterimIncomeStatement, IncomeStatementReport) as IncomeStatementReport;
}
// Update report when dates etc. changed
watch([dt, dtStart], async () => {
const session = await db.load();
updateReport(session);
});
load();
</script>