Skip to content

Recover Owned Coins pagination after coin combines - #810

Draft
joshpainter wants to merge 1 commit into
xch-dev:mainfrom
joshpainter:codex/owned-coins-page-recovery
Draft

Recover Owned Coins pagination after coin combines#810
joshpainter wants to merge 1 commit into
xch-dev:mainfrom
joshpainter:codex/owned-coins-page-recovery

Conversation

@joshpainter

Copy link
Copy Markdown
Contributor

Closes #809

Summary

  • Keep the Owned Coins page within the available range after refreshes that shrink the list, including combine operations.
  • Ignore late responses for pages the user has already left.
  • Return the correct filtered total for an out-of-range coin query so the UI can recover to the last page.

Why

Combining coins can remove enough entries that the page the user was viewing no longer exists. The existing COUNT(*) OVER() total is only available when the paginated query returns at least one row; an empty out-of-range page therefore looked like a zero-coin list, and the UI had no reliable last-page value.

The extra COUNT(*) query runs only when the requested page is empty. It reuses the same asset filter to recover the exact total for that exceptional case, while normal page loads keep the existing single-query path. This lets the UI move to the last valid page without adding work to ordinary refreshes.

Validation

  • cargo check -p sage-database
  • rustfmt --edition 2024 --check crates/sage-database/src/tables/coins.rs
  • pnpm prettier:check
  • pnpm lint (0 errors; existing warnings only)
  • pnpm build (successful; existing chunk-size warning only)

No new dependencies or tests were added.

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.

Combining coins can leave the Owned Coins list on an empty page

1 participant