Skip to content

fix(ic-dashboard): consistent empty-data KPI rendering - #176

Merged
aleksdotbar merged 2 commits into
mainfrom
fix/ic-dashboard-empty-kpis
Jun 25, 2026
Merged

fix(ic-dashboard): consistent empty-data KPI rendering#176
aleksdotbar merged 2 commits into
mainfrom
fix/ic-dashboard-empty-kpis

Conversation

@aleksdotbar

@aleksdotbar aleksdotbar commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Problem

On the IC dashboard, empty-data states render inconsistently:

  • KPI tiles drop the value to "—" for count metrics with no rows,
    and hide the peer median whenever the person has no value of
    their own — showing "No peer data" even when a cohort median
    exists.
  • The "At a glance" section is removed entirely when a person's
    top-line KPIs have no data, even with section activity — the page
    jumps straight to "Needs attention". The error case already
    renders placeholder tiles; the empty case did not.

Fix

  • Count metrics render a null period as 0 (a missing row is zero,
    not unknown), colored against the peer median like any value;
    rate/duration metrics keep "—".
  • Peer median shows whenever it exists, independent of the person's
    own value.
  • "At a glance" renders its five tiles (empty when no data) as long
    as the catalog defines them, matching users with ≥1 value.

Closes #1465

Summary by CodeRabbit

  • New Features

    • Dashboard KPI tiles now show fallback placeholder tiles when no KPI data is available, keeping the “At a glance” section populated.
  • Bug Fixes

    • Improved KPI value display for missing data: count metrics now show 0 instead of an em dash, while percent/rate metrics continue to show an em dash.
    • Peer median labels now appear more consistently, and “No peer data” is shown only when peer median information is missing.

@aleksdotbar
aleksdotbar requested a review from a team as a code owner June 24, 2026 14:54
@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@aleksdotbar, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 29 minutes and 21 seconds. Learn how PR review limits work.

To continue reviewing without waiting, enable usage-based billing in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 880ab036-f627-4874-9afd-dd7435da5cf1

📥 Commits

Reviewing files that changed from the base of the PR and between 558a588 and 97dcdb9.

📒 Files selected for processing (3)
  • src/components/widgets/v2/kpi-tile.test.tsx
  • src/components/widgets/v2/kpi-tile.tsx
  • src/screens/ic-dashboard/engineering-dashboard-v2.tsx
📝 Walkthrough

Walkthrough

KpiTile replaces hardcoded null/em-dash logic with format-driven isCountMetric derivation: count metrics default rawValue to 0 and display a formatted zero, while percent/hours metrics keep the em-dash; the median label now renders independently of hasValue. EngineeringDashboardV2 introduces a kpiTiles array that falls back to placeholder entries when kpis is empty.

Changes

KpiTile null-value display and dashboard placeholder fallback

Layer / File(s) Summary
KpiTile null-value display logic
src/components/widgets/v2/kpi-tile.tsx, src/components/widgets/v2/kpi-tile.test.tsx
Adds isCountMetric flag; count metrics compute rawValue as kpi.raw_value || 0 and display a formatted zero when null, other metrics keep "—"; peerStatusVsMedian now receives computed rawValue; medianLabel no longer requires hasValue. Three new tests cover count-null→0, percent-null→"—", and "No peer data" when peer_median is absent.
Dashboard kpiTiles placeholder fallback
src/screens/ic-dashboard/engineering-dashboard-v2.tsx
Introduces kpiTiles that uses real kpis or derives placeholder entries from kpiPlaceholders with null/empty fields; kpiTileCount prefers kpiPlaceholders.length on KPI errors; the "At a glance" grid renders kpiTiles instead of raw kpis; type imports changed to import type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • constructorfabric/insight-front#155: Modifies the same kpi-tile.tsx and kpi-tile.test.tsx files for KPI peer-median rendering/null logic, which this PR directly builds upon.

Suggested reviewers

  • mitasovr

Poem

🐇 A count of nil? No dash for me,
Just format zero, plain to see.
Peer median stands without a care,
Placeholder tiles beyond compare.
The rabbit hops through null with glee! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: making IC dashboard KPI empty-state rendering consistent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ic-dashboard-empty-kpis

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/screens/ic-dashboard/engineering-dashboard-v2.tsx`:
- Around line 86-106: The empty-data KPI path in engineering-dashboard-v2 is
still being rendered as regular KPI tiles, which causes zero-valued metrics and
peer text to appear instead of true empty cards. Update the no-data branch in
the KPI rendering logic around kpiTiles/kpiTileCount to route empty `kpis`
through `KpiTilePlaceholder` rather than `KpiTile`, so the fallback state stays
visually distinct from real KPI content while preserving the existing
`kpiPlaceholders` and `hasKpiData` checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1eac19cd-5ab4-44c1-8b7e-d234512455e9

📥 Commits

Reviewing files that changed from the base of the PR and between 5715404 and 558a588.

📒 Files selected for processing (3)
  • src/components/widgets/v2/kpi-tile.test.tsx
  • src/components/widgets/v2/kpi-tile.tsx
  • src/screens/ic-dashboard/engineering-dashboard-v2.tsx

Comment thread src/screens/ic-dashboard/engineering-dashboard-v2.tsx
Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
Signed-off-by: Aleksandr Barkhatov <pm@aleks.bar>
@aleksdotbar
aleksdotbar merged commit 489dc5a into main Jun 25, 2026
5 checks passed
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.

frontend: "At a glance" section is dropped entirely when a user's top-line KPIs have no data (even with section activity)

2 participants