fix: prevent install buttons showing before first container scan
Added containers_scanned flag to StatusInfo in the data model. Starts false, set to true after the first Podman scan completes (~15s after boot). Marketplace now shows a shimmer "Checking..." indicator on app buttons until the scan finishes, preventing users from accidentally re-installing apps that are already present but not yet enumerated. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -66,6 +66,10 @@ pub struct StatusInfo {
|
||||
pub backup_progress: Option<f32>,
|
||||
#[serde(rename = "update-progress")]
|
||||
pub update_progress: Option<f32>,
|
||||
/// True after the first container scan completes. Frontend should
|
||||
/// not show install buttons until this is true.
|
||||
#[serde(rename = "containers-scanned", default)]
|
||||
pub containers_scanned: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
@@ -253,6 +257,7 @@ impl DataModel {
|
||||
updated: false,
|
||||
backup_progress: None,
|
||||
update_progress: None,
|
||||
containers_scanned: false,
|
||||
},
|
||||
lan_address: Some("http://localhost:8100".to_string()),
|
||||
tor_address: None,
|
||||
|
||||
@@ -417,16 +417,18 @@ async fn scan_and_update_packages(
|
||||
let packages_changed = !packages.is_empty() && current_data.package_data != packages;
|
||||
let tor_addr = docker_packages::read_tor_address("archipelago");
|
||||
let tor_changed = tor_addr != current_data.server_info.tor_address;
|
||||
let first_scan = !current_data.server_info.status_info.containers_scanned;
|
||||
|
||||
if packages_changed || tor_changed {
|
||||
if packages_changed || tor_changed || first_scan {
|
||||
let mut data = current_data;
|
||||
if !packages.is_empty() {
|
||||
data.package_data = packages;
|
||||
}
|
||||
data.server_info.tor_address = tor_addr.clone();
|
||||
data.server_info.node_address = tor_addr.as_ref().map(|t| identity.node_address(t));
|
||||
data.server_info.status_info.containers_scanned = true;
|
||||
state.update_data(data).await;
|
||||
debug!("📦 State changed (packages={}, tor={}), broadcasting update", packages_changed, tor_changed);
|
||||
debug!("📦 State changed (packages={}, tor={}, first_scan={}), broadcasting update", packages_changed, tor_changed, first_scan);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user