Skip to content

refactor(watchlist): extract shared useWatchlistMinerStats hook#1245

Open
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:fix/watchlist-miner-dot-counts
Open

refactor(watchlist): extract shared useWatchlistMinerStats hook#1245
Khaostica wants to merge 1 commit into
entrius:testfrom
Khaostica:fix/watchlist-miner-dot-counts

Conversation

@Khaostica
Copy link
Copy Markdown
Contributor

@Khaostica Khaostica commented May 19, 2026

Summary

WatchlistPage and MinersList each ran the same useAllMiners()mapAllMinersToStats(...) → filter watched githubIds → map(isEligible: OSS || Discoveries) pipeline in a local useMemo. Hoist that into a single useWatchlistMinerStats(minerIds) hook so the page-level sidebar Miners Activity widgets and the table/cards row data share one source.

No behavior change — MinersList already passed through isLoading and the raw allMinersData for its "unresolved miners" warning, both of which the new hook returns alongside the mapped miners array.

Context: I opened this PR originally to fix inflated PR/Issue dot counts on the watchlist Miners tab — the /miners rollup was double-counting per-(uid, hotkey, repo) miner_evaluations rows for any githubId with multiple registrations. That has since been fixed server-side (the test-API rollup now returns the deduped numbers), so the recompute-from-/prs-and-mirror-/issues-feeds part is no longer needed. What's left is the small refactor that fell out of the original change.

Related Issues

Type of Change

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

Screenshots

Not applicable — no rendered output changes. The watchlist Miners tab renders the same numbers from the same data source as before, just from a shared hook.

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 19, 2026
Watchlist `WatchlistPage` and `MinersList` each ran the same
`useAllMiners` → `mapAllMinersToStats(...)` → filter watched
githubIds → map(isEligible: OSS || Discoveries) pipeline in a
local useMemo. Hoist into a single `useWatchlistMinerStats(minerIds)`
hook so the sidebar `Miners Activity` widgets and the table/cards
row data share one source.

No behavior change — just removes a near-duplicate useMemo block
from each call site.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Khaostica Khaostica force-pushed the fix/watchlist-miner-dot-counts branch from 83e7b83 to 01a707b Compare May 20, 2026 18:32
@Khaostica Khaostica changed the title fix(watchlist): derive miner row PR/Issue counts from /prs and /issues feeds refactor(watchlist): extract shared useWatchlistMinerStats hook May 20, 2026
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.

1 participant