Skip to content

fix(dashboard): render risk overview shell while data loads#3017

Open
simplesagar wants to merge 1 commit into
mainfrom
worktree-risk-overview-loading-shell
Open

fix(dashboard): render risk overview shell while data loads#3017
simplesagar wants to merge 1 commit into
mainfrom
worktree-risk-overview-loading-shell

Conversation

@simplesagar
Copy link
Copy Markdown
Member

Summary

  • /risk-overview was collapsing to a Loading… blob and hiding the entire Policy Activity section until data arrived, which felt slow on first paint and blinked on every time-range change.
  • Apply the same loading-shell pattern that ProjectDashboard (project home) uses: always render both Page.Section blocks, swap each KPI card / ranked list / trend chart's body for a <Skeleton> while the data is loading, and only collapse to NoPoliciesEmptyState once data has actually arrived.
  • Pass placeholderData: keepPreviousData to useRiskOverview so date-range changes don't blank the page after the first successful load. useRiskOverview (unlike the project-overview hook) includes from/to in its query key, so without this every range change re-triggers isLoading=true.
  • InsightsConfig now mounts only when overview is populated so its contextInfo never embeds undefined counts.

Test plan

  • Throttle the network and visit /risk-overview — confirm the page header, both section headers, KPI grid skeletons, three ranked-list card skeletons, and the chart skeleton all paint immediately; no Loading… text.
  • After data arrives, confirm the skeletons swap in place for the real MetricCard / RankedBarList / RiskTrendChart with no layout shift.
  • Change the time-range picker — the previous data should remain visible (no blanking) while the new range fetches.
  • Confirm NoPoliciesEmptyState still renders for a project with activePolicies === 0.
  • Confirm the error branch still renders the shell + error block on a forced failure.

🤖 Generated with Claude Code

Mirror the project-home pattern: always render both Page.Section blocks
on /risk-overview and swap individual metric/chart card bodies for
skeletons during the initial fetch. Also pass placeholderData:
keepPreviousData to useRiskOverview so changing the time range no longer
blanks the page after first load.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@simplesagar simplesagar requested review from a team as code owners May 24, 2026 01:10
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 24, 2026

⚠️ No Changeset found

Latest commit: 7eb2760

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
gram-docs-redirect Ready Ready Preview, Comment May 24, 2026 1:10am

Request Review

@simplesagar simplesagar added the preview Spawn a preview environment label May 24, 2026
@speakeasybot
Copy link
Copy Markdown
Collaborator

speakeasybot commented May 24, 2026

🚀 Preview Environment (PR #3017)

Preview URL: https://pr-3017.dev.getgram.ai

Component Status Details Updated (UTC)
✅ Database Ready Created and validated 2026-05-24 01:19:57.
✅ Images Available Container images ready 2026-05-24 01:19:17.

Gram Preview Bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Spawn a preview environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants