front: PolkadotChainSections renders 'currently elected' badge#23
Conversation
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.
There was a problem hiding this comment.
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.
| // 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. |
There was a problem hiding this comment.
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.
| // 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. |
|
|
||
| export interface PolkadotChainData { | ||
| is_elected: boolean; | ||
| observed_at_block: number; |
There was a problem hiding this comment.
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.
| observed_at_block: number; | |
| observed_at_block: number | null; |
Summary
Pairs with infra PR #20 (classification) and worker PR #33 (chain_data populator).
Test plan