Skip to content

feat(pairs): group destinations by source and show count summary#321

Open
shinzoxD wants to merge 4 commits into
StableRoute-Org:mainfrom
shinzoxD:feat/pairs-grouping-286
Open

feat(pairs): group destinations by source and show count summary#321
shinzoxD wants to merge 4 commits into
StableRoute-Org:mainfrom
shinzoxD:feat/pairs-grouping-286

Conversation

@shinzoxD

Copy link
Copy Markdown

Summary

Groups the pairs list by source asset and adds a count summary line. Sources are sorted alphabetically; destinations within a group preserve their original order from the API. The grouping is computed via useMemo from the already-filtered list, so it inherits the existing search behaviour.

Why

Operators with many destinations per source couldn't see structure at a glance. A flat ul of source -> destination rows makes it hard to count, compare, or scan for missing routes.

Changes

  • src/app/pairs/Client.tsx: added a grouped useMemo that buckets pairs by source and sorts the buckets; replaced the flat list render with a per-source
    containing the count line and the list. Added a summary line above the groups: 'N sources, M pairs total'.

Test Plan

  • Manual: load /pairs with several pairs sharing a source -- the list now groups them under a source header with a destination count.
  • Search filter still narrows both the groups and the summary counts.
  • The 4 failures in src/app/pairs/page.test.tsx are pre-existing on main (they expect 'No pairs registered yet' text that the current code emits as 'No pairs found'). Not introduced by this PR; out of scope for Show registered-pair count and per-source grouping on the pairs list #286.

Linked issue

Closes #286

Payout wallet (Stellar): GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH
GrantFox OSS campaign -- smart escrow payout on merge.

Issue StableRoute-Org#286 -- the pairs list rendered a flat ul of 'source -> destination'
rows with no summary count and no grouping, so operators with many
destinations per source cannot see structure at a glance. This change
groups destinations under each source asset (sorted alphabetically by
source) and shows a count summary line ('N sources, M pairs total').

The grouping is computed with a useMemo from the already-filtered list
so it inherits the existing search behaviour. Empty state and error
state are unchanged. The 4 pre-existing failures in
src/app/pairs/page.test.tsx (expecting 'No pairs registered yet' text
that the current code no longer emits) are not introduced by this PR
and are out of scope for StableRoute-Org#286.

Closes StableRoute-Org#286

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…discriminated-union State<T> + refetch type caused TS2339 errors\nin pairs/Client.tsx and stats/Client.tsx when destructuring\n{ status, data, error, refetch } because not every variant has\ndata/error. Flattening UseApiResult<T> to always expose\ndata: T | null and error: string | null lets callers destructure\nin one line and still narrow on status before reading the\ndata-specific values.\n\nAlso adds && data / && status.data null-guards at the two\ndata-consuming call sites (stats page totalPairs empty state and\nsettings page router status) to satisfy strict null checks.
@shinzoxD

Copy link
Copy Markdown
Author

@mikewheeleer — friendly ping on this fork PR (feat(pairs): group destinations by source and show count summary).\n\nCI is currently failing on pre-existing main-branch test flakes (window.matchMedia is not a function in ThemeToggle.test.tsx, and the api-keys Network request failed alert text — both reproduce on unmodified main, not from this PR). To get the actual CI run to execute, please open the Checks tab and click "Approve and run" so GitHub Actions can start. Payout wallet (Stellar): GBVHELLD2JE235Y2NGTDT3MWI3T65ON6SY4N6FBHYVDAQ5FZC2CP5QXH. Thanks!

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.

Show registered-pair count and per-source grouping on the pairs list

2 participants