From b352de5db4129bbe55606a4fc8ad50612617f2e5 Mon Sep 17 00:00:00 2001 From: michalsmiarowski Date: Thu, 30 Nov 2023 16:23:02 +0100 Subject: [PATCH] Fix application status error on stake details page There was a bug that caused inaccuracies in the statuses of the tbtc and random beacon apps on the stake detail page. When you refresh the details page for a stake that the apps were not authorized for, it incorrectly displays them as authorized. This issue resolves itself when you navigate to the authorization or staking page and then return to the details page. The issue arises from the fact that we did not dispatch the `getSupportedApps` action on the detail page. Consequently, the `getSupportedAppsEffect` was not triggered, leading to the `minimumAuthorization` value being set to 0 in the `selectStakingAppByStakingProvider` selector. This results in the `isAuthorized` flag being set to false. --- src/pages/Staking/StakeDetailsPage/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pages/Staking/StakeDetailsPage/index.tsx b/src/pages/Staking/StakeDetailsPage/index.tsx index cdb638b85..77476bb21 100644 --- a/src/pages/Staking/StakeDetailsPage/index.tsx +++ b/src/pages/Staking/StakeDetailsPage/index.tsx @@ -30,6 +30,7 @@ import { useAppDispatch, useAppSelector } from "../../../hooks/store" import { useWeb3React } from "@web3-react/core" import { AddressZero } from "@ethersproject/constants" import { isAddress } from "../../../web3/utils" +import { stakingApplicationsSlice } from "../../../store/staking-applications" const StakeDetailsPage: FC = () => { const { stakingProviderAddress } = useParams() @@ -41,6 +42,10 @@ const StakeDetailsPage: FC = () => { if (!isAddress(stakingProviderAddress!)) navigate(`/staking`) }, [stakingProviderAddress, navigate]) + useEffect(() => { + dispatch(stakingApplicationsSlice.actions.getSupportedApps({})) + }, [dispatch]) + useEffect(() => { dispatch( requestStakeByStakingProvider({ stakingProvider: stakingProviderAddress })