Skip to content

fix: dashboard Overview stats render a blank box on a fresh archive — show zeros instead #210

Description

@rorybyrne

Observed

On a freshly deployed archive with no conventions yet, the archive overview's What's in here → Overview panel renders a blank card: the "Overview" label with nothing under it. The adjacent "By record type" panel handles this state correctly ("No datasets yet" empty state); Overview just goes blank.

Expected

A zero-state stat row, not an empty box:

  • Published records 0
  • Derived features 0 per record
  • Stored MB

A brand-new archive already serves exactly this — GET /api/v1/stats on a fresh instance returns 200:

{"records":0,"records_this_month":0,"storage_bytes":122880,"features_per_record":0.0,"computed_at":"","data_url":"/api/v1/data"}

so the data layer supports rendering zeros today; only the panel's render path loses it.

Where

apps/dashboard/src/features/tenant-insights/WhatsInHere.tsx:

{stats.isPending ? (
  <Skeleton height="6rem" width="100%" />
) : stats.data ? (
  <div className={styles.statRow}></div>
) : null}

The : null arm means any non-pending state without data — a failed fetch through the proxy, a decode failure in decodeRecordStats — renders an empty card. The query's error state is swallowed entirely: "stats are zero", "stats failed to load", and "endpoint not reachable yet" are all indistinguishable blanks.

Suggested fix

  1. When the stats query resolves, always render the stat row — zeros included (this is the current happy path once the fetch succeeds, so the visible blank implies the error arm; fixing only the copy is not enough).
  2. Replace the null arm with an explicit state: either a retryable "Couldn't load stats" note, or a zero-valued stat row with a subtle "unavailable" treatment — anything but a silently empty card.
  3. Give Overview the same courtesy "By record type" already has: a deliberate empty/zero state designed for the first-run experience, since a new archive owner lands here before their first convention deploy.

Acceptance

  • Fresh archive (no conventions, no records): Overview shows 0 / 0 per record / <n> MB, never a blank card.
  • Stats endpoint erroring: Overview shows an explicit failure state (distinguishable from zeros), never a blank card.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions