Dashboard-Ladezeit durch geteilte Datenabfragen optimiert

This commit is contained in:
2026-08-07 19:07:20 +02:00
parent d2e0b4ca0f
commit 9421c3221c
5 changed files with 69 additions and 18 deletions

View File

@@ -11,6 +11,7 @@ import {
} from "~/composables/useDepreciation"
const loading = ref(true)
const { loadCoreData } = useDashboardData()
const summary = ref({
label: "",
income: 0,
@@ -47,11 +48,11 @@ const loadSummary = async () => {
end: dayjs().endOf("month")
}
const [docs, incoming, allocations] = await Promise.all([
useEntities("createddocuments").select(),
useEntities("incominginvoices").select(),
const [coreData, allocations] = await Promise.all([
loadCoreData(),
useEntities("statementallocations").select("*, bankstatement(*)")
])
const { createdDocuments: docs, incomingInvoices: incoming } = coreData
const outputDocs = (docs || []).filter((doc: any) => {
if (!isRelevantOutputDocument(doc)) {

View File

@@ -17,6 +17,7 @@ const props = defineProps({
})
const tempStore = useTempStore()
const { loadCoreData } = useDashboardData()
const isMounted = ref(false)
const amountMode = ref("net")
@@ -82,10 +83,7 @@ watch([amountMode, granularity, selectedYear, selectedMonth], () => {
})
const loadData = async () => {
const [docs, incoming] = await Promise.all([
useEntities("createddocuments").select(),
useEntities("incominginvoices").select()
])
const { createdDocuments: docs, incomingInvoices: incoming } = await loadCoreData()
incomeDocuments.value = (docs || []).filter((item) => item.state === "Gebucht" && ["invoices", "advanceInvoices", "cancellationInvoices"].includes(item.type))
expenseInvoices.value = (incoming || []).filter((item) => item.state === "Gebucht" && item.date)

View File

@@ -13,6 +13,7 @@ import {
dayjs.extend(customParseFormat)
const auth = useAuthStore()
const { loadCoreData } = useDashboardData()
const loading = ref(true)
const summary = ref({
@@ -39,10 +40,7 @@ const loadSummary = async () => {
const periodType = normalizeTaxEvaluationPeriod(auth.activeTenantData?.taxEvaluationPeriod)
const bounds = getTaxEvaluationPeriodBounds(dayjs(), periodType)
const [docs, incoming] = await Promise.all([
useEntities("createddocuments").select(),
useEntities("incominginvoices").select()
])
const { createdDocuments: docs, incomingInvoices: incoming } = await loadCoreData()
const outputDocs = (docs || []).filter((doc: any) => {
if (doc?.state !== "Gebucht") return false