Skip to content

fix(watchlist): repos chart bars render at zero due to wrong config field#1275

Open
blinkeye-lcm wants to merge 1 commit into
entrius:testfrom
blinkeye-lcm:fix/watchlist-chart-zero-weight
Open

fix(watchlist): repos chart bars render at zero due to wrong config field#1275
blinkeye-lcm wants to merge 1 commit into
entrius:testfrom
blinkeye-lcm:fix/watchlist-chart-zero-weight

Conversation

@blinkeye-lcm
Copy link
Copy Markdown
Contributor

Summary

The bar chart on the Watchlist repositories tab renders every bar with value 0, contradicting the Weight column shown in the list view directly beneath it. The chart reads repo.config?.weight, but the API config blob has no weight field, only emissionShare. The access typechecks because RepositoryConfig carries a [key: string]: unknown index signature, so the value is always undefined at runtime and every bar collapses to zero.

Fixed by reading from the already hoisted repo.weight field on WatchedRepoStats, which was added specifically for downstream sort and render code per the type's own comment at src/pages/WatchlistPage.tsx:1020-1030.

Reproducer

  1. Run npm run dev
  2. Star at least two repositories from the watchlist controls
  3. Navigate to /watchlist?tab=repos
  4. Open the Options panel and enable the chart view via the BarChart icon
  5. Every bar renders at zero. With the default log scale they sit below the axis floor and are invisible. With linear scale they render as flat zero-height bars

Related Issues

N/A

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other (describe below)

Screenshots

Before: chart toggled on with two pinned repos, every bar at zero (invisible under log scale).

b1

After: chart toggled on with the same two pinned repos, bars render with values matching the Weight column in the list view below.

a1

Checklist

  • New components are modularized/separated where sensible
  • Uses predefined theme (e.g. no hardcoded colors)
  • Responsive/mobile checked
  • Tested against the test API
  • npm run format and npm run lint:fix have been run
  • npm run build passes
  • Screenshots included for any UI/visual changes

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 26, 2026
@ventura-oss
Copy link
Copy Markdown
Contributor

Thanks for catching the zero-bar bug, @blinkeye-lcm — the diagnosis is right, but the fix doesn't quite land. repo.weight is null for every repo in the live /dash/repos data, so Number(repo.weight) || 0 still evaluates to 0 and the bars stay flat. The value you want is config.emissionShare — that's what the chart's axis max (maxWeight) and the weight column/sort already read, so the bars need to match it:

const weight = parseFloat(String(repo.config?.emissionShare ?? 0)) || 0;

Could you switch to that field and rebase on the latest test? It's drifted behind since #1277 merged into the same file. (The red CI here is just a checkout-step hiccup, not your code.) Thanks!

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants