diff --git a/rust/agama-lib/src/product/store.rs b/rust/agama-lib/src/product/store.rs index c8afa18b99..9fd964c34c 100644 --- a/rust/agama-lib/src/product/store.rs +++ b/rust/agama-lib/src/product/store.rs @@ -23,6 +23,7 @@ use super::{ProductHTTPClient, ProductSettings}; use crate::base_http_client::BaseHTTPClient; use crate::error::ServiceError; use crate::manager::http_client::ManagerHTTPClient; +use std::{thread, time}; /// Loads and stores the product settings from/to the D-Bus service. pub struct ProductStore { @@ -76,6 +77,17 @@ impl ProductStore { } if let Some(reg_code) = &settings.registration_code { let email = settings.registration_email.as_deref().unwrap_or(""); + + if probe { + // give the UI a short time for processing the events related to changing the + // product before starting registration because it triggers another pile of events + // in the Web UI as well (workaround for gh#agama-project#2274) + // even 1 second should be enough, but rather be safe and use 5s for slow networks, + // in autoinstallation it does not hurt + let delay = time::Duration::from_secs(5); + thread::sleep(delay); + } + self.product_client.register(reg_code, email).await?; // TODO: avoid reprobing if the system has been already registered with the same code? probe = true; diff --git a/rust/package/agama.changes b/rust/package/agama.changes index db0b10b0e5..d5e9406c22 100644 --- a/rust/package/agama.changes +++ b/rust/package/agama.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Apr 22 11:16:29 UTC 2025 - Ladislav Slezák + +- CLI: wait a bit between selecting the product to install and + registering it so the Web UI has enough time to process all + events (gh#agama-project/agama#2274) + ------------------------------------------------------------------- Mon Apr 21 13:42:13 UTC 2025 - Imobach Gonzalez Sosa diff --git a/web/package/agama-web-ui.changes b/web/package/agama-web-ui.changes index 702ee8a06b..77fbed450e 100644 --- a/web/package/agama-web-ui.changes +++ b/web/package/agama-web-ui.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Apr 22 11:18:03 UTC 2025 - Ladislav Slezák + +- Process the product changed event so the UI can better react on + registering the product shortly after that + (gh#agama-project/agama#2274) + ------------------------------------------------------------------- Mon Apr 21 12:37:20 UTC 2025 - Imobach Gonzalez Sosa diff --git a/web/src/queries/status.ts b/web/src/queries/status.ts index 7aa91dc854..d779e065f2 100644 --- a/web/src/queries/status.ts +++ b/web/src/queries/status.ts @@ -26,6 +26,7 @@ import { fetchInstallerStatus } from "~/api/status"; import { useInstallerClient } from "~/context/installer"; import { InstallerStatus } from "~/types/status"; import { QueryHookOptions } from "~/types/queries"; +import { selectedProductQuery } from "./software"; const MANAGER_SERVICE = "org.opensuse.Agama.Manager1"; @@ -81,6 +82,10 @@ const useInstallerStatusChanges = () => { if (type === "IssuesChanged") { queryClient.invalidateQueries({ queryKey: ["status"] }); } + + if (event.type === "ProductChanged") { + queryClient.invalidateQueries({ queryKey: selectedProductQuery().queryKey }); + } }); }); };