Skip to content

Conversation

@anabelle
Copy link
Contributor

@anabelle anabelle commented Oct 25, 2025

Problem

  • staying on Transaction Status while an unconfirmed tx confirms leaves the screen blank instead of showing confirmed details

Root Cause

  • the screen re-fetch relies on a useEffect that only depends on hash & wallet references
  • when we call fetchAndSaveWalletTransactions() the wallet object keeps the same identity but its last fetch timestamp changes, so the effect never re-runs

Solution

  • memoize wallet.getLastTxFetch() and include it in the dependency array so the effect re-queries the updated transaction
  • add a regression unit test to ensure the UI refresh happens when the fetch timestamp advances

Testing

  • npx jest tests/unit/transaction-status.test.tsx

Fixes #7984.

Copilot AI review requested due to automatic review settings October 25, 2025 16:19
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where the transaction status screen fails to update when a transaction gets confirmed while the user is viewing it. The problem stemmed from missing dependency tracking in the useEffect hook that synchronizes transaction data from the wallet to local state.

Key Change:

  • Added wallet?.getLastTxFetch() to the useEffect dependency array in TransactionStatus.tsx to trigger re-synchronization when wallet transaction data is updated

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@anabelle anabelle requested a review from Copilot October 25, 2025 16:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@anabelle anabelle force-pushed the fix/transaction-status-update-on-confirmation branch from 829cc2b to a5c117b Compare October 25, 2025 16:41
@Overtorment
Copy link
Member

@cursoragent review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@limpbrains limpbrains left a comment

Choose a reason for hiding this comment

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

Hi Anabelle, thank you for the PR!

Please take a look at the useWalletSubscribe hook we have — it was created for exactly the same reason: to update the React view when something changes inside the wallet.

@anabelle anabelle force-pushed the fix/transaction-status-update-on-confirmation branch from d68daf6 to aa0246f Compare November 11, 2025 00:47
- Cache wallet last fetch timestamp with useMemo to avoid redundant reads
- Trigger transaction data reload when fetch timestamp advances
- Add regression unit test covering confirmation refresh behaviour
Address review feedback by using the existing useWalletSubscribe hook
instead of manually memoizing getLastTxFetch(). The hook was specifically
designed to provide automatic wallet updates when transactions change.

Changes:
- Import and use useWalletSubscribe(walletID) to get subscribedWallet
- Replace wallet state setter to use subscribedWallet instead of finding from wallets array
- Replace transaction sync effect to use subscribedWallet and remove lastTxFetch dependency
- Update test to mock useWalletSubscribe hook

The hook polls getLastTxFetch() every second internally and returns a
proxied wallet that triggers re-renders when changes are detected.
@anabelle anabelle force-pushed the fix/transaction-status-update-on-confirmation branch from aa0246f to 480d9e9 Compare November 11, 2025 00:49
@anabelle anabelle requested a review from limpbrains November 11, 2025 00:49
The test was failing because useWalletSubscribe returns a new proxied
wallet when lastTxFetch changes. Updated the mock to create a new Proxy
instance when the update function changes lastTxFetch, simulating the
hook's behavior.
@anabelle
Copy link
Contributor Author

Done! Switched to using useWalletSubscribe as suggested.

@GladosBlueWallet
Copy link
Collaborator

@GladosBlueWallet
Copy link
Collaborator

@Overtorment
Copy link
Member

reran all tests here: #8172
all passed.
tested on device, works as expected

Copy link
Member

@Overtorment Overtorment left a comment

Choose a reason for hiding this comment

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

LGTM

@Overtorment Overtorment merged commit 71372b8 into BlueWallet:master Nov 17, 2025
6 of 10 checks passed
@Overtorment
Copy link
Member

squash-merged because git history is not up to a standard.
thanks for the contribution!

@limpbrains
Copy link
Collaborator

@anabelle thank you for your contribution!

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.

After waiting for confirmation staying on tx details screen, screen transitions to a broken screen

4 participants