Skip to content

Commit f4f72c4

Browse files
committed
fix: auto-fetch profile from network when no cached data exists
When a wallet with an existing identity is imported, identity discovery stores the identity in the local DB but the DashPay profile is not cached. Previously, the Profile Screen would show 'No Profile Loaded' and require the user to manually click 'Refresh' to fetch from the network. Now, when load_profile_from_database() finds no cached profile data, it automatically queues a network fetch via pending_action. This runs on the next UI frame through the existing pending_action mechanism in render(). The auto-fetch is safe from infinite loops because trigger_load_profile() sets profile_load_attempted = true, which prevents re-triggering in subsequent refresh() calls. Fixes #759
1 parent dfdf7c3 commit f4f72c4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/ui/dashpay/profile_screen.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,13 @@ impl ProfileScreen {
319319
}
320320
}
321321
Ok(None) => {
322-
tracing::debug!("No profile found in database for identity {}", identity_id);
322+
tracing::debug!(
323+
"No profile found in database for identity {}, will auto-fetch from network",
324+
identity_id
325+
);
326+
// No cached profile exists — queue an automatic network fetch
327+
// so the user doesn't have to manually click "Refresh".
328+
self.pending_action = Some(Box::new(self.trigger_load_profile()));
323329
}
324330
Err(e) => {
325331
tracing::error!("Error loading profile from database: {}", e);

0 commit comments

Comments
 (0)