From b8fd2e21cd6fa4620f81c29ea4eebfac183f7c99 Mon Sep 17 00:00:00 2001 From: KoalaSat Date: Fri, 15 Mar 2024 02:18:06 +0100 Subject: [PATCH] Fix renew order refresh (#1179) --- frontend/src/basic/OrderPage/index.tsx | 9 +++++++-- frontend/src/components/TradeBox/index.tsx | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/basic/OrderPage/index.tsx b/frontend/src/basic/OrderPage/index.tsx index 53b79f82b..b47a46e52 100644 --- a/frontend/src/basic/OrderPage/index.tsx +++ b/frontend/src/basic/OrderPage/index.tsx @@ -49,10 +49,15 @@ const OrderPage = (): JSX.Element => { setBaseUrl(`${url}${basePath}`); const orderId = Number(params.orderId); - if (orderId && currentOrderId.id !== orderId && currentOrderId.shortAlias !== shortAlias) + if ( + orderId && + currentOrderId.id !== orderId && + currentOrderId.shortAlias !== shortAlias && + shortAlias + ) setCurrentOrderId({ id: orderId, shortAlias }); if (!acknowledgedWarning) setOpen({ ...closeAll, warning: true }); - }, [params]); + }, [params, currentOrderId]); const onClickCoordinator = function (): void { if (currentOrder?.shortAlias != null) { diff --git a/frontend/src/components/TradeBox/index.tsx b/frontend/src/components/TradeBox/index.tsx index bad53f7a9..28d790610 100644 --- a/frontend/src/components/TradeBox/index.tsx +++ b/frontend/src/components/TradeBox/index.tsx @@ -118,7 +118,7 @@ interface Contract { const TradeBox = ({ baseUrl, onStartAgain }: TradeBoxProps): JSX.Element => { const { garage, orderUpdatedAt, setBadOrder } = useContext(GarageContext); const { settings, hostUrl, origin } = useContext(AppContext); - const { federation } = useContext(FederationContext); + const { federation, setCurrentOrderId } = useContext(FederationContext); const navigate = useNavigate(); // Buttons and Dialogs @@ -186,6 +186,7 @@ const TradeBox = ({ baseUrl, onStartAgain }: TradeBoxProps): JSX.Element => { setBadOrder(data.bad_request); } else if (data.id !== undefined) { navigate(`/order/${String(currentOrder?.shortAlias)}/${String(data.id)}`); + setCurrentOrderId({ id: data.id, shortAlias: currentOrder?.shortAlias }); } }) .catch(() => {