Skip to content

Fix DividendIncomeMini hidden for users with past dividends#175

Merged
fleveque merged 1 commit into
mainfrom
fix/dividend-income-mini-window
May 25, 2026
Merged

Fix DividendIncomeMini hidden for users with past dividends#175
fleveque merged 1 commit into
mainfrom
fix/dividend-income-mini-window

Conversation

@fleveque

Copy link
Copy Markdown
Owner

Reported in prod after #174 merged.

Bug

User has several recorded dividends but the DividendIncomeMini card never renders on the dashboard.

Root cause

/dividends/chart_data returns 24 buckets per currency: 12 past + 12 future. Past months carry actual (paid), future months carry projected (forecasted from holdings).

My code did buckets.slice(-12) — grabbing the last 12 entries, which is the future half (current month + 11 forward). Their actual is mostly null, so the empty-state guard total === 0 fired and the card hid itself, unless the user happened to have a payment in the current month.

Fix

Filter to past-only entries (actual !== null) and take the last 12. Robust to wider server windows (e.g. range=full opens the window further).

Test plan

  • npx tsc --noEmit — clean
  • Manual: logged in with an account that has historical dividends → DividendIncomeMini renders with this-month total + 12-bar sparkline
  • Manual: empty account (no recorded dividends) → mini stays hidden

🤖 Generated with Claude Code

The server's `/dividends/chart_data` returns 24 buckets per currency:
12 past + 12 future. Past months carry `actual` (paid), future ones
carry `projected` (forecasted from holdings).

`slice(-12)` grabbed the wrong half — the *last* 12 entries are the
projection window (current month + 11 forward). Their `actual` is
mostly `null`, so the "total of actual values" sat at 0 unless the
user happened to have a payment in the current month. Result: users
with months of dividend history saw the whole card hidden.

Filter past-only entries (`actual !== null`) and take the last 12 of
those — robust to wider server windows like `range=full`. This is
the data the "Last 12 months" sparkline already advertises.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fleveque fleveque merged commit 2979d4a into main May 25, 2026
5 checks passed
@fleveque fleveque deleted the fix/dividend-income-mini-window branch May 25, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant