Skip to content

fix(miners): show real dates in PR list Date column (#1111)#1119

Open
Khaostica wants to merge 2 commits into
entrius:testfrom
Khaostica:fix/issue-1111-pr-date-column
Open

fix(miners): show real dates in PR list Date column (#1111)#1119
Khaostica wants to merge 2 commits into
entrius:testfrom
Khaostica:fix/issue-1111-pr-date-column

Conversation

@Khaostica
Copy link
Copy Markdown

@Khaostica Khaostica commented May 13, 2026

Summary

The Pull Requests table on miner detail pages rendered the literal strings Open or Closed in the Date column for any PR that wasn't merged — contradicting both the column label and the sort comparator (which already ordered by a real timestamp).

This PR:

  • Adds a getPrDateInfo(pr) helper that resolves the Date column to the milestone matching the PR state: merged → mergedAt, closed → closedAt, open → prCreatedAt.
  • Wraps the cell in a Tooltip that names the milestone the date refers to (Merged May 7, 2026 / Closed May 8, 2026 / Opened May 6, 2026).
  • Updates the Date sort comparator to use the same helper so order matches what users see.
  • Renders for any row whose resolvable date is still null.

Note on the dash render

/miners/:id/prs currently returns only mergedAt, so non-merged rows fall back to until the das endpoint includes prCreatedAt and closedAt. Both fields are already declared on the CommitLog type and consumed elsewhere in the codebase — tracking the backend request in #1120. Once those fields land on the wire, the cell renderer picks them up automatically with no further UI change.

An earlier revision of this PR fanned out to the mirror and to GitHub REST to fill in the missing dates client-side. That was reverted per review feedback (this comment) — it duplicated a data path the type already commits to and added a rate-limit surface other components don't take on.

Related Issues

Closes #1111
Depends on #1120 (backend)

Type of Change

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

Screenshots

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

The Pull Requests table on miner detail pages rendered the literal
strings "Open" or "Closed" for non-merged PRs while the column header
read "Date" and its sort comparator used a real timestamp — the
display contradicted both the label and the ordering.

This change always renders a date that corresponds to the PR's state
(merged date / closed date / opened date), with a tooltip naming the
milestone the date refers to (e.g. "Opened May 6, 2026").

Because /miners/:id/prs only returns mergedAt, the missing dates are
sourced from two fallbacks: the mirror's /miners/:id/pulls endpoint
(bulk, for repos the subnet tracks) and per-row GitHub REST for the
visible page (lazy, cached forever in React Query). Unresolved rows
still degrade to "—" rather than misreporting a state as a date.

Closes entrius#1111
@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 13, 2026
@Khaostica Khaostica marked this pull request as ready for review May 13, 2026 17:37
@andriypolanski
Copy link
Copy Markdown
Contributor

Hi @Khaostica,

In my opinion, adding a new API just to fetch each PR’s timestamp in MinerPRsTable.tsx and MinerApi.ts may not be the best approach. This implementation could break the existing code convention and introduce inconsistency across the project.

If the server provides these two properties, closedAt and prCreatedAt, directly as described in the CommitLog type, this issue can be resolved much more cleanly and easily.

Hope this helps.

Per review feedback on entrius#1111: layering mirror + GitHub fan-out fallbacks
on top of /miners/:id/prs duplicates a data path the CommitLog type
already commits to (closedAt, prCreatedAt) and introduces inconsistency
with how other components consume miner data.

Reverts useMinerPullDates and useGithubPrDates. Non-merged rows render
"—" until the das endpoint includes prCreatedAt and closedAt. The cell
renderer already consumes both fields, so once the backend ships them
the rows light up with no further UI change.

The Date column still correctly resolves merged > closed > opened with
a milestone-naming tooltip and a sort comparator that uses the same
date the cell displays — that part of the original fix stays.
@Khaostica
Copy link
Copy Markdown
Author

Fair point, and I agree with you @andriypolanski. The mirror + GitHub fan-out was an attempt to ship something usable end-to-end given the current /miners/:id/prs response, but you're right that it duplicates a data path the CommitLog type already commits to.

I've reverted the two hooks (useMinerPullDates, useGithubPrDates) in 5a27e0c. The Date column now relies solely on mergedAt / closedAt / prCreatedAt from CommitLog, so non-merged rows render until the das endpoint includes those fields — opened #1120 to track that. Once they land on the wire the renderer picks them up with no further UI change.

The UI-only parts of the original fix stay: the getPrDateInfo helper, the milestone-naming tooltip, and the sort comparator using the same date the cell displays. PR description has been updated to reflect the reduced scope.

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.

[BUG] PR list "Date" column shows the words "Open" / "Closed" instead of dates for non-merged PRs

2 participants