From 447f8a5efbe98029917a3e006ef4feebae7c5b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Iv=C3=A1n=20L=C3=B3pez=20Gonz=C3=A1lez?= Date: Fri, 27 Oct 2023 10:20:05 +0100 Subject: [PATCH] [web] Adapt to changes in master --- web/src/App.jsx | 4 ++-- web/src/App.test.jsx | 6 +++--- web/src/context/product.jsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/src/App.jsx b/web/src/App.jsx index 50e09eedff..f54c50ce9e 100644 --- a/web/src/App.jsx +++ b/web/src/App.jsx @@ -24,7 +24,7 @@ import { Outlet } from "react-router-dom"; import { _ } from "~/i18n"; import { useInstallerClient, useInstallerClientStatus } from "~/context/installer"; -import { useSoftware } from "./context/software"; +import { useProduct } from "./context/product"; import { STARTUP, INSTALL } from "~/client/phase"; import { BUSY } from "~/client/status"; @@ -57,7 +57,7 @@ const ATTEMPTS = 3; function App() { const client = useInstallerClient(); const { attempt } = useInstallerClientStatus(); - const { products } = useSoftware(); + const { products } = useProduct(); const { language } = useL10n(); const [status, setStatus] = useState(undefined); const [phase, setPhase] = useState(undefined); diff --git a/web/src/App.test.jsx b/web/src/App.test.jsx index 84092633b6..59b0753521 100644 --- a/web/src/App.test.jsx +++ b/web/src/App.test.jsx @@ -31,9 +31,9 @@ jest.mock("~/client"); // list of available products let mockProducts; -jest.mock("~/context/software", () => ({ - ...jest.requireActual("~/context/software"), - useSoftware: () => { +jest.mock("~/context/product", () => ({ + ...jest.requireActual("~/context/product"), + useProduct: () => { return { products: mockProducts, selectedProduct: null diff --git a/web/src/context/product.jsx b/web/src/context/product.jsx index 1d79959fdd..4f476f710a 100644 --- a/web/src/context/product.jsx +++ b/web/src/context/product.jsx @@ -72,7 +72,7 @@ function useProduct() { } const { products = [], selectedId } = context; - const selectedProduct = products.find(p => p.id === selectedId); + const selectedProduct = products.find(p => p.id === selectedId) || null; return { ...context, selectedProduct }; }