fix(spl): set initial sync status according to parent wallet
What changed, and why it matters
This commit fixes a small UI consistency bug for Solana token wallets. Previously, the token wallet screen always showed itself as 'synced' when first opened, even if the parent Solana wallet was still syncing. Now it checks the parent wallet's actual sync state and shows 'syncing' if appropriate. There is no direct security vulnerability here; it is a correctness and user-experience fix.
No security action required. Treat as a normal UI/UX bug fix. If desired, verify that `pSolanaWallet` is available and that `refreshMutex.isLocked` correctly reflects the parent wallet's sync state across the supported platforms.
Security signals we found
No security-relevant signals in diff
UI state consistency fix only
No input validation, cryptography, authentication, or authorization changes
Evidence from the diff
The change removes a hardcoded WalletSyncStatus.synced fallback in two Solana token view widgets and instead reads pSolanaWallet(walletId).refreshMutex.isLocked to determine the initial sync status. The desktop view also stops recomputing the status inline in the build method and uses the precomputed initialSyncStatus field. This aligns the token wallet’s displayed state with the parent wallet’s refresh mutex, preventing a stale ‘synced’ indicator during an active refresh.
Changed components
lib/pages/token_view/sol_token_view.dartlib/pages_desktop_specific/my_stack_view/wallet_view/desktop_sol_token_view.dartInspect captured patch +11 / −12
diff --git a/lib/pages/token_view/sol_token_view.dart b/lib/pages/token_view/sol_token_view.dart
index b7812ee..d206d23 100644
--- a/lib/pages/token_view/sol_token_view.dart
+++ b/lib/pages/token_view/sol_token_view.dart
@@ -55,8 +55,11 @@ class _SolTokenViewState extends ConsumerState<SolTokenView> {
@override
void initState() {
- // TODO: Integrate Solana token refresh status when available.
- initialSyncStatus = WalletSyncStatus.synced;
+ // Get the initial sync status from the Solana wallet's refresh mutex.
+ final solanaWallet = ref.read(pSolanaWallet(widget.walletId));
+ initialSyncStatus = solanaWallet?.refreshMutex.isLocked ?? false
+ ? WalletSyncStatus.syncing
+ : WalletSyncStatus.synced;
// Initialize the Solana token wallet provider with mock data.
// This sets up the pCurrentSolanaTokenWallet provider so that
diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_sol_token_view.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_sol_token_view.dart
index c5b1ab6..65aa72b 100644
--- a/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_sol_token_view.dart
+++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/desktop_sol_token_view.dart
@@ -65,8 +65,11 @@ class _DesktopTokenViewState extends ConsumerState<DesktopSolTokenView> {
WidgetsBinding.instance.addPostFrameCallback((_) {
_initializeSolanaTokenWallet();
});
- // TODO: Integrate Solana token refresh status when available.
- initialSyncStatus = WalletSyncStatus.synced;
+ // Get the initial sync status from the Solana wallet's refresh mutex.
+ final solanaWallet = ref.read(pSolanaWallet(widget.walletId));
+ initialSyncStatus = solanaWallet?.refreshMutex.isLocked ?? false
+ ? WalletSyncStatus.syncing
+ : WalletSyncStatus.synced;
super.initState();
}
@@ -192,14 +195,7 @@ class _DesktopTokenViewState extends ConsumerState<DesktopSolTokenView> {
DesktopWalletSummary(
walletId: widget.walletId,
isToken: true,
- initialSyncStatus:
- ref
- .watch(pWallets)
- .getWallet(widget.walletId)
- .refreshMutex
- .isLocked
- ? WalletSyncStatus.syncing
- : WalletSyncStatus.synced,
+ initialSyncStatus: initialSyncStatus,
),
const Spacer(),
DesktopWalletFeatures(walletId: widget.walletId),
Why this scored 17/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.