Skip to content

Commit

Permalink
Fix application status error on stake details page
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michalsmiarowski committed Nov 30, 2023
1 parent 4f9b5cb commit b352de5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pages/Staking/StakeDetailsPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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 })
Expand Down

0 comments on commit b352de5

Please sign in to comment.