Skip to content

fix(dashboard): clear usage spinner and show empty state - #2957

Draft
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdashboard-restore-empty-state-and-ddfdf9
Draft

fix(dashboard): clear usage spinner and show empty state#2957
posthog-eu[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixdashboard-restore-empty-state-and-ddfdf9

Conversation

@posthog-eu

@posthog-eu posthog-eu Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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. onMounted loaded data only when main.dashboardFetched was true; otherwise it waited on watch(dashboard, ...). When the store fetch fails, dashboard never changes, the watcher never fires, isLoading stays true, and every ChartCard keeps its spinner forever.
  • Blank widgets with no explanation. noData was hard-coded to computed(() => false), so an account with no usage rendered the full widget grid with nothing in it.

Changes

  • Spinner always clears. Wrap loadData in try/finally so isLoading is reset even if a fetch throws, and add a bounded fallback timer in onMounted: if the dashboard watcher has not loaded within INITIAL_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 noData check (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 /dashboard and /app/:id for 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.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

The dashboard usage widget could spin forever or show blank charts.

- onMounted only loaded data when `main.dashboardFetched` was true and
  otherwise waited on a `watch(dashboard, ...)` that never fires when the
  store fetch fails, so `isLoading` stayed true and every chart kept its
  spinner. Add a bounded fallback timer and wrap `loadData` in try/finally so
  the spinner always clears.
- `noData` was hard-coded to `false`, so an account with no usage rendered a
  grid of empty widgets. Restore a real check and render a clear empty state
  when loading is done, no demo charts show, and every day is empty.

Generated-By: PostHog Code
Task-Id: 6218e6b3-a7a1-480c-becf-ac536c4cd586
@codspeed-hq

codspeed-hq Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing posthog-self-driving/fixdashboard-restore-empty-state-and-ddfdf9 (c8d9034) with main (b62668a)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sonarqubecloud

sonarqubecloud Bot commented Aug 9, 2026

Copy link
Copy Markdown

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.

0 participants