Skip to content

Keep dashboard overview counts when the verification chart fails - #23

Open
jay23606 wants to merge 1 commit into
mafzalkalwardev:mainfrom
jay23606:pr-go/22-keep-dashboard-counts-when-the-verificat
Open

jay23606 wants to merge 1 commit into
mafzalkalwardev:mainfrom
jay23606:pr-go/22-keep-dashboard-counts-when-the-verificat

Conversation

@jay23606

@jay23606 jay23606 commented Nov 4, 2026

Copy link
Copy Markdown

Bug

In public/dashboard.html, both dashboard requests run inside one startup block. When /api/history/stats failed (or the Chart.js doughnut threw), the catch showed the "Failed to load stats" toast and then returned. That skipped /api/dashboard/overview, so the unread inbox, running campaigns, suppressed emails and sender accounts stayed as dashes.

Change

Removed the return; from the stats catch. The overview request now runs regardless of the stats outcome. The toast is still shown on a stats failure, and the empty-history path (all zeros) is unchanged.

Testing

Added tests/dashboardOverview.test.js. It extracts the page's inline script, runs it in a vm sandbox with a stubbed axios where the stats call rejects and the overview call resolves, and asserts the overview counts are filled.

  • node --test tests/dashboardOverview.test.js: fails on the unfixed code (overview must still fill cmdUnread when stats fails), passes after the change.
  • npm test: 18 of 18 tests pass.

Regression test: fails on base twice (/overview must still fill cmdUnread when stats fails/), passes on fix twice (node --test tests/dashboardOverview.test.js)

Fixes #22

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.

Keep dashboard counts when the verification chart fails

1 participant