Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jun 14 05:34:52 UTC 2024 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- 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 <dgonzalez@suse.com>

Expand Down
8 changes: 2 additions & 6 deletions web/src/components/product/ProductSelectionPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
Expand All @@ -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("/");
Expand Down
8 changes: 7 additions & 1 deletion web/src/context/product.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ProductContext.Provider value={value}>{children}</ProductContext.Provider>;
}

Expand Down