Skip to content

Comments

fix: prevent token tx history screen from fetching duplicated request and showing duplicated txs#832

Merged
pedroferreira1 merged 2 commits intomasterfrom
fix/token-tx-history-duplication
Jan 28, 2026
Merged

fix: prevent token tx history screen from fetching duplicated request and showing duplicated txs#832
pedroferreira1 merged 2 commits intomasterfrom
fix/token-tx-history-duplication

Conversation

@pedroferreira1
Copy link
Member

Acceptance Criteria

  • Prevent concurrent requests for loading tx history of a token

@pedroferreira1 pedroferreira1 self-assigned this Jan 28, 2026
@pedroferreira1 pedroferreira1 moved this from Todo to In Progress (Done) in Hathor Network Jan 28, 2026
Comment on lines +892 to +898
const existingData = get(state.tokensHistory, `${token}.data`, []);

// Create a Set of existing txIds for efficient lookup
const existingTxIds = new Set(existingData.map((tx) => tx.txId));

// Filter out any transactions that already exist to prevent duplicates
const uniqueNewHistory = newHistory.filter((tx) => !existingTxIds.has(tx.txId));
Copy link
Member Author

Choose a reason for hiding this comment

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

There's still one race condition that I couldn't find, so I decided to go with the deduplication code. With this code I could've removed the other part, this would already prevent showing duplicated txs but the rest of the code is also an improvement.

@pedroferreira1 pedroferreira1 moved this from In Progress (Done) to In Review (WIP) in Hathor Network Jan 28, 2026
@tuliomir tuliomir moved this from In Review (WIP) to In Review (Done) in Hathor Network Jan 28, 2026
@pedroferreira1 pedroferreira1 merged commit 0a1f954 into master Jan 28, 2026
1 check passed
@github-project-automation github-project-automation bot moved this from In Review (Done) to Waiting to be deployed in Hathor Network Jan 28, 2026
@pedroferreira1 pedroferreira1 deleted the fix/token-tx-history-duplication branch January 28, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting to be deployed

Development

Successfully merging this pull request may close these issues.

3 participants