Delay SPL token balance fallback refresh#94
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR introduces a delayed balance refresh mechanism for token operations. A new constant parameterizes the refresh delay, and a memoized callback schedules ChangesDelayed Balance Refresh Integration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5842400b03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| setTimeout(() => { | ||
| refreshBalances().catch(console.error); | ||
| }, BALANCE_FALLBACK_REFRESH_DELAY_MS); |
There was a problem hiding this comment.
Cancel stale delayed balance refreshes
If a user clicks Reset or runs a new Setup in the 2.5s after a transfer/delegate/withdraw succeeds, this pending timer still invokes the refreshBalances closure captured from the old mint/token program and then calls setAccounts(updated). That can overwrite the current account cards with ATAs and balances for the previous mint after the UI has switched context; keep only the latest timer or cancel it on mint/token-program changes/unmount before applying the fallback refresh.
Useful? React with 👍 / 👎.
Summary
Validation
Summary by CodeRabbit