Skip to content

front: PolkadotChainSections renders 'currently elected' badge#23

Merged
simonmorley merged 2 commits into
mainfrom
dot-cleanup
Apr 25, 2026
Merged

front: PolkadotChainSections renders 'currently elected' badge#23
simonmorley merged 2 commits into
mainfrom
dot-cleanup

Conversation

@simonmorley
Copy link
Copy Markdown
Member

Summary

  • New `PolkadotChainSections` component reads `chain_data.is_elected` from the API and renders a Yes/No status field on validator detail pages.
  • Replaces the demoted `dot_not_elected` feed event surface — that event_type is reclassified `condition` (infra PR Celestia 2b: add Celestia (TIA) to types + labels + dynamic header count #20) so its historical rows stay out of the public feed.
  • Same pattern as Solana's `software_version` and Cosmos's `jailed` fields: chain_data describes live condition, never an event.

Pairs with infra PR #20 (classification) and worker PR #33 (chain_data populator).

Test plan

  • `npm run build`: zero TS errors
  • After all three PRs deploy: open a Polkadot validator detail page; "Active Set" panel shows "Currently Elected: Yes" (green) or "No" (red)

Simon Morley added 2 commits April 25, 2026 10:56
Uses chain_data.is_elected from the Polkadot collector to render
a Yes/No status field on the validator detail page. Replaces the
previous dot_not_elected feed event surface — that event_type is
now classified 'condition' (migration on infra branch) so its
historical rows stay out of the public feed and any future
emissions are auto-suppressed by the classification filter.

Same pattern as Solana's software_version and Cosmos's jailed
fields — chain_data describes the live condition, never an event.
Avoids the deploy-gap UX regression where a Polkadot validator
detail page would render 'Currently Elected: No' (red) for every
validator before the worker chain_data populator reaches prod.
undefined !== false; better to render nothing than wrong data.
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for Polkadot chain data by defining the PolkadotChainData interface and implementing the PolkadotChainSections component to display election status and block information. The review feedback identifies a discrepancy in a code comment regarding a non-existent label and a type mismatch where observed_at_block should be marked as nullable to align with its conditional rendering in the UI.

Comment thread src/components/ChainDataSections.tsx Outdated
Comment on lines +710 to +713
// Replaces the demoted dot_not_elected feed event. The "(historical)"
// label is intentional — the badge below describes the live state,
// and any past dot_not_elected rows the validator may still have on
// their history are condition-classified and excluded from the feed.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The comment mentions that a "(historical)" label is intentional, but this string does not appear in the component's labels or values. If the badge is intended to describe the live state (as the comment also states), the reference to a historical label is confusing and should likely be removed or clarified to avoid misleading future maintainers.

Suggested change
// Replaces the demoted dot_not_elected feed event. The "(historical)"
// label is intentional — the badge below describes the live state,
// and any past dot_not_elected rows the validator may still have on
// their history are condition-classified and excluded from the feed.
// Replaces the demoted dot_not_elected feed event. The badge below
// describes the live state, and any past dot_not_elected rows the
// validator may still have on their history are condition-classified
// and excluded from the feed.

Comment thread src/types/api.ts

export interface PolkadotChainData {
is_elected: boolean;
observed_at_block: number;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The observed_at_block field is checked for nullability in the PolkadotChainSections component (line 724), but it is defined as a non-nullable number here. To ensure type consistency with the implementation and handle cases where block data might be missing, it should be marked as nullable.

Suggested change
observed_at_block: number;
observed_at_block: number | null;

@simonmorley simonmorley merged commit 6e24489 into main Apr 25, 2026
2 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.

1 participant