Skip to content

5.6.22#1729

Merged
arhtudormorar merged 6 commits intomainfrom
development
Mar 17, 2026
Merged

5.6.22#1729
arhtudormorar merged 6 commits intomainfrom
development

Conversation

@arhtudormorar
Copy link
Copy Markdown
Contributor

@arhtudormorar arhtudormorar commented Mar 17, 2026

Issue

Account balance does not update in the UI after receiving an incoming transaction via WebSocket.

Reproduce

Issue exists on sdk-dapp v5 (Zustand store).

  1. Log in to dapp with any account
  2. Have a second account send EGLD to the logged-in account
  3. Observe that the transactionCompleted WebSocket event fires and the TransactionReceivedToast appears — but the account balance displayed on the dashboard remains stale

Root cause

trackTransactionsrecheckStatuscheckTransactionStatus exits early when there are no pending outgoing transaction sessions (entries.length === 0). This is always the case for incoming transactions since the wallet has no session tracking them.

For outgoing transactions, checkBatch calls refreshAccount() once the batch completes, which updates the Zustand account store. For incoming transactions, nothing triggered refreshAccount(), leaving the balance stale until a page refresh.

In sdk-dapp v4 (Redux-based) this was handled internally by the store. In v5 (Zustand), setAccount must be called explicitly via refreshAccount().

Fix

In setupWebSocketTracking inside trackTransactions.ts, after calling recheckStatus(), check whether there are no pending outgoing sessions. If so (incoming transaction case) and the user is logged in, call refreshAccount().

File: src/methods/trackTransactions/trackTransactions.ts

const hasPendingSessions =
  Object.keys(
    pendingTransactionsSessionsSelector(store.getState())
  ).length > 0;

if (!hasPendingSessions && getIsLoggedIn()) {
  refreshAccount();
}

This is intentionally placed inside setupWebSocketTracking (WS event subscriber only) rather than in checkTransactionStatus or recheckStatus, to avoid triggering unnecessary API calls on:

  • Initial recheckStatus() call at startup (line 81)
  • Periodic polling interval (when WS is unavailable)

Additional changes

None.

Contains breaking changes

  • No
  • Yes

Updated CHANGELOG

  • No
  • Yes

Testing

  • User testing
  • Unit tests

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a bug where the UI's account balance remained stale after receiving incoming transactions via WebSocket. Previously, the system only triggered account refreshes for outgoing transactions or manual page reloads. The implemented solution ensures that when an incoming transaction is detected via WebSocket and no outgoing transactions are pending, the account data is explicitly refreshed, providing real-time balance updates to the user interface.

Highlights

  • Account Balance Update: Fixed an issue where the account balance in the UI would not update after receiving an incoming transaction via WebSocket, leading to stale data display.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • CHANGELOG.md
    • Added a new changelog entry for version 5.6.22, documenting the fix for the account balance not updating after incoming WebSocket transactions.
  • package.json
    • Updated the package version from 5.6.21 to 5.6.22.
  • src/methods/trackTransactions/trackTransactions.ts
    • Imported getIsLoggedIn, pendingTransactionsSessionsSelector, and refreshAccount.
    • Implemented logic within setupWebSocketTracking to check for incoming transactions (no pending outgoing sessions) and call refreshAccount() if the user is logged in, ensuring the UI updates.
Activity
  • User testing was performed to validate the fix.
  • The CHANGELOG.md file was updated to include the new version and the fix description.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

mgavrila
mgavrila previously approved these changes Mar 17, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an issue where the account balance wasn't updating for incoming WebSocket transactions. The fix involves explicitly calling refreshAccount() for such cases, which seems correct. My review includes a few suggestions to improve code consistency and performance. I've pointed out a minor formatting issue in the CHANGELOG.md and suggested refactoring in trackTransactions.ts to reorder imports for better organization and to optimize state access for slightly better performance.

Comment thread CHANGELOG.md
Comment thread src/methods/trackTransactions/trackTransactions.ts
Comment thread src/methods/trackTransactions/trackTransactions.ts
radumojic
radumojic previously approved these changes Mar 17, 2026
@arhtudormorar arhtudormorar dismissed stale reviews from mgavrila and radumojic via e9af74c March 17, 2026 14:39
@arhtudormorar arhtudormorar merged commit 199db38 into main Mar 17, 2026
3 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.

3 participants