diff --git a/web/package/agama-web-ui.changes b/web/package/agama-web-ui.changes index 4b232703f3..0ab75f8d40 100644 --- a/web/package/agama-web-ui.changes +++ b/web/package/agama-web-ui.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Jun 14 05:34:52 UTC 2024 - Imobach Gonzalez Sosa + +- Do not redirect to the products selection page again after + selecting a product (gh#openSUSE/agama#1334). + ------------------------------------------------------------------- Thu Jun 13 10:52:22 UTC 2024 - David Diaz diff --git a/web/src/components/product/ProductSelectionPage.jsx b/web/src/components/product/ProductSelectionPage.jsx index ecbde0b74a..fa89f06faf 100644 --- a/web/src/components/product/ProductSelectionPage.jsx +++ b/web/src/components/product/ProductSelectionPage.jsx @@ -33,7 +33,6 @@ import styles from '@patternfly/react-styles/css/utilities/Text/text'; import { _ } from "~/i18n"; import { Page } from "~/components/core"; import { Loading, Center } from "~/components/layout"; -import { useInstallerClient } from "~/context/installer"; import { useProduct } from "~/context/product"; const Label = ({ children }) => ( @@ -44,17 +43,14 @@ const Label = ({ children }) => ( function ProductSelectionPage() { const navigate = useNavigate(); - const { manager, product } = useInstallerClient(); - const { products, selectedProduct } = useProduct(); + const { products, selectedProduct, selectProduct } = useProduct(); const [nextProduct, setNextProduct] = useState(selectedProduct); const onSubmit = async (e) => { e.preventDefault(); if (nextProduct) { - // TODO: handle errors - await product.select(nextProduct.id); - manager.startProbing(); + await selectProduct(nextProduct.id); } navigate("/"); diff --git a/web/src/context/product.jsx b/web/src/context/product.jsx index 6be4672278..3079193e63 100644 --- a/web/src/context/product.jsx +++ b/web/src/context/product.jsx @@ -65,7 +65,13 @@ function ProductProvider({ children }) { return client.product.onRegistrationChange(setRegistration); }, [client, setRegistration]); - const value = { products, selectedId, registration }; + const selectProduct = async (id) => { + await client.product.select(id); + client.manager.startProbing(); + setSelectedId(id); + }; + + const value = { products, selectedId, registration, selectProduct }; return {children}; }