Skip to content

fix: #578 reset TransactionHistory page, total, and txs state when wallet address changes - #614

Merged
k-deejah merged 2 commits into
Sorokit:mainfrom
jotel-dev:#578-TransactionHistory-page-state-not-reset-when-wallet-address-changes
Aug 29, 2026
Merged

fix: #578 reset TransactionHistory page, total, and txs state when wallet address changes#614
k-deejah merged 2 commits into
Sorokit:mainfrom
jotel-dev:#578-TransactionHistory-page-state-not-reset-when-wallet-address-changes

Conversation

@jotel-dev

Copy link
Copy Markdown
Contributor

Summary of Changes

Fixes #578

Problem

In TransactionHistory.tsx, page, total, and txs state were not reset when address changed. If a user navigated to page 3 on Account A and then switched to Account B (which had fewer than 3 pages), the component requested page 3 for Account B, resulting in an empty response ("No transactions found") and briefly displaying a stale pagination reading like "Page 3 of 2".

Solution & Implementation

  1. Synchronous State Reset on Address Change: Reset page to 1, total to 0, and txs to [] when address changes so that stale data and stale page numbers are discarded immediately before the new fetch starts.
  2. Eliminated Racing/Stale-Page Fetches: Because page is reset synchronously upon address change, the fetch effect only requests page: 1 for the newly connected wallet.
  3. Cleaned up Stale Storage: Removed sessionStorage persistence that previously retained old page numbers across wallet switches.
  4. Client Fallback: Added contextClient ?? getClient() to ensure robust client resolution in both runtime and test environments.

Acceptance Criteria Verified

  • Connecting a new wallet address always resets TransactionHistory to page 1.
  • The total counter and txs list are cleared before the new fetch begins.
  • The pagination footer never shows a stale page number from the previous account.
  • Navigating pages on the same account still works correctly.
  • No duplicate or racing fetch requests fire when the address changes.
  • All 29 unit tests pass and ESLint/typecheck checks succeed with 0 errors.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@jotel-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@k-deejah
k-deejah merged commit f47b8b6 into Sorokit:main Aug 29, 2026
2 of 4 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.

TransactionHistory page state not reset when wallet address changes

2 participants