fix(dashboard): clear usage spinner and show empty state - #2957
Draft
posthog-eu[bot] wants to merge 1 commit into
Draft
fix(dashboard): clear usage spinner and show empty state#2957posthog-eu[bot] wants to merge 1 commit into
posthog-eu[bot] wants to merge 1 commit into
Conversation
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
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
The usage widget (
src/components/dashboard/Usage.vue) is the first screen after login on both/dashboardand/app/:id. It failed silently in two ways: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.noDatawas hard-coded tocomputed(() => false), so an account with no usage rendered the full widget grid with nothing in it.Changes
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.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
updateDashboardfailure insrc/stores/organization.ts. Thatconsole.errorcatch 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
/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.Screenshots
Checklist
bun run lint:backend && bun run lint.accordingly.
my tests
Created with PostHog Desktop from this inbox report.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.