fix(dashboard): clear usage spinner and show empty state
Draft
PO
2mo ago+67+67+01234567890123456789-33-33-01234567890123456789
Summary
The usage widget (src/components/dashboard/Usage.vue) is the first screen after login on both /dashboard and /app/:id. It failed silently in two ways:
- Spinner that never clears.
onMountedloaded data only whenmain.dashboardFetchedwastrue; otherwise it waited onwatch(dashboard, ...). When the store fetch fails,dashboardnever changes, the watcher never fires,isLoadingstaystrue, and everyChartCardkeeps its spinner forever. - Blank widgets with no explanation.
noDatawas hard-coded tocomputed(() => false), so an account with no usage rendered the full widget grid with nothing in it.
Changes
- Spinner always clears. Wrap
loadDataintry/finallysoisLoadingis reset even if a fetch throws, and add a bounded fallback timer inonMounted: if thedashboardwatcher has not loaded withinINITIAL_LOAD_FALLBACK_MS(6s), load anyway. The app-level view fetches its own stats, so it no longer waits on an unrelated org-level fetch. - Real empty state. Restore a meaningful
noDatacheck (loading done, not showing demo charts, every day empty) and render a clear "No data" state instead of a grid of empty widgets. The no-apps demo experience is unchanged.
[!NOTE]
The report also suggested un-swallowing the updateDashboard failure in src/stores/organization.ts. That console.error catch is left in place on purpose: the org watcher is reactive and should not throw, and its stated harm — a stranded spinner — is removed here at the component level. Once the spinner clears, the existing Reload button in the widget is the retry path. Removing the catch adds risk without changing what the user observes.
Test plan
- Load
/dashboardand/app/:idfor an org whose stats fetch fails or stalls; confirm the spinner clears within ~6s and charts fall back to an empty or demo state instead of spinning forever. - Load the dashboard for an account with apps but no usage data; confirm a single "No data" state renders instead of empty widgets.
- Confirm accounts with data and the payment-failed / no-apps demo states are unchanged.
Screenshots
Checklist
- My code follows the code style of this project and passes
bun run lint:backend && bun run lint. - My change requires a change to the documentation.
- I have updated the documentation
accordingly. - My change has adequate E2E test coverage.
- I have tested my code manually, and I have provided steps how to reproduce
my tests
Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.