Dashboard Refactor: Flow-based Metrics + Unified Data Model #4
Reference in New Issue
Block a user
No description provided.
Delete Branch "cached-reports"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Dashboard Refactor: Flow-based Metrics + Unified Data Model
Summary
This MR transforms the dashboard into a flow-driven, backend-powered analytics system with a significantly cleaner architecture and improved UX.
Overview
This MR introduces a major refactor of the dashboard and report data model, transitioning from separate
expense/incomehandling to a unified flow-based (outflows/inflows) system backed by a singlemetricstructure.It simplifies data handling, improves UI consistency, and enables better extensibility for future analytics.
Key Changes
1. Data Model Simplification
Replaced:
expenses/incomesWith:
metric2. Flow-based System (Core Change)
Introduced:
Replaced all references of:
expense→outflowsincome→inflowsFlow is now:
useReport)3. API Changes
useReportRemoved legacy params:
group_by,rolling,include_transactions, etc.New structure:
Backend now handles:
4. Period System Update
Removed:
Added:
dailyallUpdated helpers:
periodIdToKeybuildPeriodIdbuildLabel5. React Query UX Improvement
6. Dashboard State Refactor
Before
After
onFlowChangecallbackDashboard.tsx)7. UI Improvements
Flow Toggle
Replaced mode toggle with:
Loading State Handling
Added
isFetchingacross componentsUI behavior during fetch:
Drill-down UX
Added:
8. New Components
TopPayees
New analytics card
Shows top payees based on:
Supports:
9. Adapter Layer Simplification
Removed mode branching everywhere
Examples:
getAmount(period)now uses:LatestItems,TopTags,HistoryChart:10. GroupKey Generalization
Before
After
Behavioral Changes
Benefits
metric)Migration Notes
Replace all
modeusages withflowUpdate adapters to use
metricRemove assumptions about:
expensesincomesEnsure API supports:
flowFuture Scope
Testing Notes
Verify:
Flow toggle updates API calls
No UI flicker on filter change
Drill-down works across:
Daily / Weekly / Monthly / All tabs behave correctly
Loading state disables interaction properly