[PR #7510] [AI] Cache the reports cards #25779

Open
opened 2026-04-16 18:51:28 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/actualbudget/actual/pull/7510
Author: @mnil
Created: 4/15/2026
Status: 🔄 Open

Base: masterHead: mnil/cache-report-cards


📝 Commits (1)

📊 Changes

28 files changed (+419 additions, -71 deletions)

View changed files

📝 packages/desktop-client/src/accounts/mutations.ts (+42 -8)
📝 packages/desktop-client/src/budget/mutations.ts (+41 -8)
📝 packages/desktop-client/src/components/reports/reports/AgeOfMoney.tsx (+7 -1)
📝 packages/desktop-client/src/components/reports/reports/AgeOfMoneyCard.tsx (+7 -1)
📝 packages/desktop-client/src/components/reports/reports/BudgetAnalysis.tsx (+6 -1)
📝 packages/desktop-client/src/components/reports/reports/BudgetAnalysisCard.tsx (+6 -1)
📝 packages/desktop-client/src/components/reports/reports/Calendar.tsx (+9 -8)
📝 packages/desktop-client/src/components/reports/reports/CalendarCard.tsx (+7 -1)
📝 packages/desktop-client/src/components/reports/reports/CashFlow.tsx (+35 -2)
📝 packages/desktop-client/src/components/reports/reports/CashFlowCard.tsx (+6 -1)
📝 packages/desktop-client/src/components/reports/reports/Crossover.tsx (+15 -2)
📝 packages/desktop-client/src/components/reports/reports/CrossoverCard.tsx (+14 -2)
📝 packages/desktop-client/src/components/reports/reports/CustomReport.tsx (+38 -2)
📝 packages/desktop-client/src/components/reports/reports/GetCardData.tsx (+15 -2)
📝 packages/desktop-client/src/components/reports/reports/NetWorth.tsx (+18 -2)
📝 packages/desktop-client/src/components/reports/reports/NetWorthCard.tsx (+28 -2)
📝 packages/desktop-client/src/components/reports/reports/Sankey.tsx (+11 -1)
📝 packages/desktop-client/src/components/reports/reports/SankeyCard.tsx (+8 -1)
📝 packages/desktop-client/src/components/reports/reports/Spending.tsx (+7 -1)
📝 packages/desktop-client/src/components/reports/reports/SpendingCard.tsx (+7 -1)

...and 8 more files

📄 Description

Description

When selecting the reports page, for me the cards take a few seconds for me to load. This change adds caching so that the old data are reused while the fetching of new data happens asynchronously and the card updates when it is fetched.

n/a

Testing

In a larger budget select the reports page. Also tested by going to the reports page, adding some new data to some account, and then going back to the reports page and watch the card update after a few seconds.

Checklist

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I understand what each change in the code does and why it is needed

Bundle Stats

Bundle Files count Total bundle size % Changed
desktop-client 34 12.92 MB → 12.93 MB (+9.96 kB) +0.08%
loot-core 1 4.85 MB 0%
api 1 3.88 MB 0%
cli 1 7.91 MB 0%
View detailed bundle stats

desktop-client

Total

Files count Total bundle size % Changed
34 12.92 MB → 12.93 MB (+9.96 kB) +0.08%
Changeset
File Δ Size
src/components/reports/useReport.ts 📈 +109 B (+23.54%) 463 B → 572 B
src/components/reports/reports/GetCardData.tsx 📈 +980 B (+12.28%) 7.79 kB → 8.75 kB
src/components/reports/reports/CrossoverCard.tsx 📈 +929 B (+9.39%) 9.66 kB → 10.57 kB
src/global-events.ts 📈 +317 B (+9.05%) 3.42 kB → 3.73 kB
src/components/reports/reports/SummaryCard.tsx 📈 +434 B (+6.64%) 6.39 kB → 6.81 kB
src/components/reports/reports/CashFlow.tsx 📈 +581 B (+6.12%) 9.27 kB → 9.83 kB
src/components/reports/reports/SankeyCard.tsx 📈 +453 B (+5.95%) 7.43 kB → 7.87 kB
src/components/reports/reports/CustomReport.tsx 📈 +2.41 kB (+5.77%) 41.78 kB → 44.19 kB
src/components/reports/reports/SpendingCard.tsx 📈 +427 B (+5.48%) 7.61 kB → 8.02 kB
src/accounts/mutations.ts 📈 +682 B (+5.29%) 12.6 kB → 13.26 kB
src/components/reports/reports/BudgetAnalysisCard.tsx 📈 +372 B (+5.15%) 7.05 kB → 7.41 kB
src/budget/mutations.ts 📈 +631 B (+4.99%) 12.36 kB → 12.97 kB
src/sync-events.ts 📈 +397 B (+4.88%) 7.95 kB → 8.34 kB
src/components/reports/reports/AgeOfMoneyCard.tsx 📈 +400 B (+4.80%) 8.13 kB → 8.52 kB
src/components/reports/reports/CashFlowCard.tsx 📈 +328 B (+3.07%) 10.44 kB → 10.76 kB
src/payees/mutations.ts 📈 +58 B (+2.72%) 2.08 kB → 2.14 kB
src/components/reports/reports/Sankey.tsx 📈 +762 B (+2.60%) 28.58 kB → 29.32 kB
src/components/reports/reports/Crossover.tsx 📈 +996 B (+2.36%) 41.27 kB → 42.25 kB
src/components/reports/reports/AgeOfMoney.tsx 📈 +403 B (+2.23%) 17.68 kB → 18.07 kB
src/tags/mutations.ts 📈 +58 B (+2.07%) 2.74 kB → 2.8 kB
src/components/reports/reports/Summary.tsx 📈 +523 B (+2.00%) 25.57 kB → 26.08 kB
src/components/reports/reports/Spending.tsx 📈 +421 B (+1.80%) 22.8 kB → 23.21 kB
src/components/reports/reports/BudgetAnalysis.tsx 📈 +358 B (+1.76%) 19.92 kB → 20.27 kB
src/components/reports/reports/NetWorth.tsx 📈 +229 B (+1.58%) 14.16 kB → 14.38 kB
src/components/reports/reports/CalendarCard.tsx 📈 +88 B (+0.67%) 12.9 kB → 12.99 kB
src/components/reports/reports/Calendar.tsx 📉 -32 B (-0.11%) 27.61 kB → 27.58 kB
src/components/reports/reports/NetWorthCard.tsx 📉 -3.1 kB (-39.38%) 7.87 kB → 4.77 kB
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger

Asset File Size % Changed
static/js/ReportRouter.js 1.18 MB → 1.18 MB (+7.87 kB) +0.65%
static/js/index.js 1.85 MB → 1.85 MB (+772 B) +0.04%
static/js/extends.js 486.5 kB → 487.23 kB (+740 B) +0.15%
static/js/Value.js 4.34 MB → 4.34 MB (+631 B) +0.01%

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
static/js/BackgroundImage.js 121.09 kB 0%
static/js/FormulaEditor.js 814.39 kB 0%
static/js/PayeeRuleCountLabel.js 52.12 kB 0%
static/js/ScheduleEditForm.js 136.13 kB 0%
static/js/TransactionEdit.js 185.13 kB 0%
static/js/TransactionList.js 82.8 kB 0%
static/js/ca.js 191.72 kB 0%
static/js/chart-theme.js 705.55 kB 0%
static/js/client.js 450.92 kB 0%
static/js/da.js 104.4 kB 0%
static/js/de.js 174.12 kB 0%
static/js/en-GB.js 8.2 kB 0%
static/js/en.js 176.5 kB 0%
static/js/es.js 181.54 kB 0%
static/js/fr.js 176.79 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.46 kB 0%
static/js/it.js 165.68 kB 0%
static/js/narrow.js 363.68 kB 0%
static/js/nb-NO.js 151.58 kB 0%
static/js/nl.js 108.66 kB 0%
static/js/pl.js 88.34 kB 0%
static/js/pt-BR.js 177.18 kB 0%
static/js/resize-observer.js 18.06 kB 0%
static/js/th.js 178.91 kB 0%
static/js/theme.js 30.79 kB 0%
static/js/uk.js 212.28 kB 0%
static/js/useFormatList.js 9.86 kB 0%
static/js/wide.js 292 B 0%
static/js/workbox-window.prod.es5.js 7.33 kB 0%
static/js/zh-Hans.js 110.19 kB 0%

loot-core

Total

Files count Total bundle size % Changed
1 4.85 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.Dtv5lNQw.js 4.85 MB 0%

api

Total

Files count Total bundle size % Changed
1 3.88 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
index.js 3.88 MB 0%

cli

Total

Files count Total bundle size % Changed
1 7.91 MB 0%
View detailed bundle breakdown

Added
No assets were added

Removed
No assets were removed

Bigger
No assets were bigger

Smaller
No assets were smaller

Unchanged

Asset File Size % Changed
cli.js 7.91 MB 0%

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/actualbudget/actual/pull/7510 **Author:** [@mnil](https://github.com/mnil) **Created:** 4/15/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `mnil/cache-report-cards` --- ### 📝 Commits (1) - [`52b2531`](https://github.com/actualbudget/actual/commit/52b253149656b89b6e8e32048ac81125debb1354) [AI] Cache report cards ### 📊 Changes **28 files changed** (+419 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `packages/desktop-client/src/accounts/mutations.ts` (+42 -8) 📝 `packages/desktop-client/src/budget/mutations.ts` (+41 -8) 📝 `packages/desktop-client/src/components/reports/reports/AgeOfMoney.tsx` (+7 -1) 📝 `packages/desktop-client/src/components/reports/reports/AgeOfMoneyCard.tsx` (+7 -1) 📝 `packages/desktop-client/src/components/reports/reports/BudgetAnalysis.tsx` (+6 -1) 📝 `packages/desktop-client/src/components/reports/reports/BudgetAnalysisCard.tsx` (+6 -1) 📝 `packages/desktop-client/src/components/reports/reports/Calendar.tsx` (+9 -8) 📝 `packages/desktop-client/src/components/reports/reports/CalendarCard.tsx` (+7 -1) 📝 `packages/desktop-client/src/components/reports/reports/CashFlow.tsx` (+35 -2) 📝 `packages/desktop-client/src/components/reports/reports/CashFlowCard.tsx` (+6 -1) 📝 `packages/desktop-client/src/components/reports/reports/Crossover.tsx` (+15 -2) 📝 `packages/desktop-client/src/components/reports/reports/CrossoverCard.tsx` (+14 -2) 📝 `packages/desktop-client/src/components/reports/reports/CustomReport.tsx` (+38 -2) 📝 `packages/desktop-client/src/components/reports/reports/GetCardData.tsx` (+15 -2) 📝 `packages/desktop-client/src/components/reports/reports/NetWorth.tsx` (+18 -2) 📝 `packages/desktop-client/src/components/reports/reports/NetWorthCard.tsx` (+28 -2) 📝 `packages/desktop-client/src/components/reports/reports/Sankey.tsx` (+11 -1) 📝 `packages/desktop-client/src/components/reports/reports/SankeyCard.tsx` (+8 -1) 📝 `packages/desktop-client/src/components/reports/reports/Spending.tsx` (+7 -1) 📝 `packages/desktop-client/src/components/reports/reports/SpendingCard.tsx` (+7 -1) _...and 8 more files_ </details> ### 📄 Description <!-- Thank you for submitting a pull request! Make sure to follow the instructions to write release notes for your PR — it should only take a minute or two: https://github.com/actualbudget/docs#writing-good-release-notes. Try running yarn generate:release-notes *before* pushing your PR for an interactive experience. --> ## Description <!-- What does this PR do? Why is it needed? Please give context on the "why?": why do we need this change? What problem is it solving for you?--> When selecting the reports page, for me the cards take a few seconds for me to load. This change adds caching so that the old data are reused while the fetching of new data happens asynchronously and the card updates when it is fetched. ## Related issue(s) <!-- e.g. Fixes #123, Relates to #456 --> n/a ## Testing <!-- What did you test? How can we reproduce the issue you are fixing or how can we test the feature you built? --> In a larger budget select the reports page. Also tested by going to the reports page, adding some new data to some account, and then going back to the reports page and watch the card update after a few seconds. ## Checklist - [x] Release notes added (see link above) - [x] No obvious regressions in affected areas - [x] Self-review has been performed - I understand what each change in the code does and why it is needed <!--- actual-bot-sections ---> <!--- bundlestats-action-comment key:combined start ---> ### Bundle Stats Bundle | Files count | Total bundle size | % Changed ------ | ----------- | ----------------- | --------- desktop-client | 34 | 12.92 MB → 12.93 MB (+9.96 kB) | +0.08% loot-core | 1 | 4.85 MB | 0% api | 1 | 3.88 MB | 0% cli | 1 | 7.91 MB | 0% <details> <summary>View detailed bundle stats</summary> #### desktop-client **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 34 | 12.92 MB → 12.93 MB (+9.96 kB) | +0.08% <details> <summary>Changeset</summary> File | Δ | Size ---- | - | ---- `src/components/reports/useReport.ts` | 📈 +109 B (+23.54%) | 463 B → 572 B `src/components/reports/reports/GetCardData.tsx` | 📈 +980 B (+12.28%) | 7.79 kB → 8.75 kB `src/components/reports/reports/CrossoverCard.tsx` | 📈 +929 B (+9.39%) | 9.66 kB → 10.57 kB `src/global-events.ts` | 📈 +317 B (+9.05%) | 3.42 kB → 3.73 kB `src/components/reports/reports/SummaryCard.tsx` | 📈 +434 B (+6.64%) | 6.39 kB → 6.81 kB `src/components/reports/reports/CashFlow.tsx` | 📈 +581 B (+6.12%) | 9.27 kB → 9.83 kB `src/components/reports/reports/SankeyCard.tsx` | 📈 +453 B (+5.95%) | 7.43 kB → 7.87 kB `src/components/reports/reports/CustomReport.tsx` | 📈 +2.41 kB (+5.77%) | 41.78 kB → 44.19 kB `src/components/reports/reports/SpendingCard.tsx` | 📈 +427 B (+5.48%) | 7.61 kB → 8.02 kB `src/accounts/mutations.ts` | 📈 +682 B (+5.29%) | 12.6 kB → 13.26 kB `src/components/reports/reports/BudgetAnalysisCard.tsx` | 📈 +372 B (+5.15%) | 7.05 kB → 7.41 kB `src/budget/mutations.ts` | 📈 +631 B (+4.99%) | 12.36 kB → 12.97 kB `src/sync-events.ts` | 📈 +397 B (+4.88%) | 7.95 kB → 8.34 kB `src/components/reports/reports/AgeOfMoneyCard.tsx` | 📈 +400 B (+4.80%) | 8.13 kB → 8.52 kB `src/components/reports/reports/CashFlowCard.tsx` | 📈 +328 B (+3.07%) | 10.44 kB → 10.76 kB `src/payees/mutations.ts` | 📈 +58 B (+2.72%) | 2.08 kB → 2.14 kB `src/components/reports/reports/Sankey.tsx` | 📈 +762 B (+2.60%) | 28.58 kB → 29.32 kB `src/components/reports/reports/Crossover.tsx` | 📈 +996 B (+2.36%) | 41.27 kB → 42.25 kB `src/components/reports/reports/AgeOfMoney.tsx` | 📈 +403 B (+2.23%) | 17.68 kB → 18.07 kB `src/tags/mutations.ts` | 📈 +58 B (+2.07%) | 2.74 kB → 2.8 kB `src/components/reports/reports/Summary.tsx` | 📈 +523 B (+2.00%) | 25.57 kB → 26.08 kB `src/components/reports/reports/Spending.tsx` | 📈 +421 B (+1.80%) | 22.8 kB → 23.21 kB `src/components/reports/reports/BudgetAnalysis.tsx` | 📈 +358 B (+1.76%) | 19.92 kB → 20.27 kB `src/components/reports/reports/NetWorth.tsx` | 📈 +229 B (+1.58%) | 14.16 kB → 14.38 kB `src/components/reports/reports/CalendarCard.tsx` | 📈 +88 B (+0.67%) | 12.9 kB → 12.99 kB `src/components/reports/reports/Calendar.tsx` | 📉 -32 B (-0.11%) | 27.61 kB → 27.58 kB `src/components/reports/reports/NetWorthCard.tsx` | 📉 -3.1 kB (-39.38%) | 7.87 kB → 4.77 kB </details> <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- static/js/ReportRouter.js | 1.18 MB → 1.18 MB (+7.87 kB) | +0.65% static/js/index.js | 1.85 MB → 1.85 MB (+772 B) | +0.04% static/js/extends.js | 486.5 kB → 487.23 kB (+740 B) | +0.15% static/js/Value.js | 4.34 MB → 4.34 MB (+631 B) | +0.01% **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/BackgroundImage.js | 121.09 kB | 0% static/js/FormulaEditor.js | 814.39 kB | 0% static/js/PayeeRuleCountLabel.js | 52.12 kB | 0% static/js/ScheduleEditForm.js | 136.13 kB | 0% static/js/TransactionEdit.js | 185.13 kB | 0% static/js/TransactionList.js | 82.8 kB | 0% static/js/ca.js | 191.72 kB | 0% static/js/chart-theme.js | 705.55 kB | 0% static/js/client.js | 450.92 kB | 0% static/js/da.js | 104.4 kB | 0% static/js/de.js | 174.12 kB | 0% static/js/en-GB.js | 8.2 kB | 0% static/js/en.js | 176.5 kB | 0% static/js/es.js | 181.54 kB | 0% static/js/fr.js | 176.79 kB | 0% static/js/indexeddb-main-thread-worker-e59fee74.js | 13.46 kB | 0% static/js/it.js | 165.68 kB | 0% static/js/narrow.js | 363.68 kB | 0% static/js/nb-NO.js | 151.58 kB | 0% static/js/nl.js | 108.66 kB | 0% static/js/pl.js | 88.34 kB | 0% static/js/pt-BR.js | 177.18 kB | 0% static/js/resize-observer.js | 18.06 kB | 0% static/js/th.js | 178.91 kB | 0% static/js/theme.js | 30.79 kB | 0% static/js/uk.js | 212.28 kB | 0% static/js/useFormatList.js | 9.86 kB | 0% static/js/wide.js | 292 B | 0% static/js/workbox-window.prod.es5.js | 7.33 kB | 0% static/js/zh-Hans.js | 110.19 kB | 0% </div> </details> --- #### loot-core **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 4.85 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.Dtv5lNQw.js | 4.85 MB | 0% </div> </details> --- #### api **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 3.88 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- index.js | 3.88 MB | 0% </div> </details> --- #### cli **Total** Files count | Total bundle size | % Changed ----------- | ----------------- | --------- 1 | 7.91 MB | 0% <details> <summary>View detailed bundle breakdown</summary> <div> **Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- cli.js | 7.91 MB | 0% </div> </details> </details> <!--- bundlestats-action-comment key:combined end ---> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-16 18:51:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#25779