Skip to content

Commit f0d32d8

Browse files
authored
Merge pull request #3299 from IntersectMBO/fix/3230-redirect-to-governance-action-outcomes-pillar-from-voting-pillar-on-disconnected-state
2 parents d4fe1a5 + 93cd69c commit f0d32d8

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ changes.
1616

1717
### Fixed
1818

19+
- Fix missing redirect to outcomes on wallet disconnected state [Issue 3230](https://github.com/IntersectMBO/govtool/issues/3230)
20+
1921
### Changed
2022

2123
### Removed

govtool/frontend/src/pages/GovernanceActionDetails.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import {
66
generatePath,
77
} from "react-router-dom";
88
import { Box, CircularProgress, Link } from "@mui/material";
9+
import { AxiosError } from "axios";
910

1011
import { Background, Typography } from "@atoms";
11-
import { ICONS, PATHS } from "@consts";
12+
import { ICONS, OUTCOMES_PATHS, PATHS } from "@consts";
1213
import { useCardano } from "@context";
1314
import {
1415
useGetProposalQuery,
@@ -45,18 +46,28 @@ export const GovernanceActionDetails = () => {
4546
const fullProposalId = txHash && getFullGovActionId(txHash, index);
4647
const shortenedGovActionId = txHash && getShortenedGovActionId(txHash, index);
4748

48-
const { data, isLoading } = useGetProposalQuery(
49+
const { data, isLoading, error } = useGetProposalQuery(
4950
fullProposalId ?? "",
5051
!state?.proposal,
5152
);
5253
const proposal = (data ?? state)?.proposal;
5354

5455
useEffect(() => {
55-
if (isEnabled && getItemFromLocalStorage(`${WALLET_LS_KEY}_stake_key`)) {
56+
const isProposalNotFound =
57+
(error as AxiosError)?.response?.data ===
58+
`Proposal with id: ${fullProposalId} not found`;
59+
if (isProposalNotFound && fullProposalId) {
60+
navigate(
61+
OUTCOMES_PATHS.governanceActionOutcomes.replace(":id", fullProposalId),
62+
);
63+
} else if (
64+
isEnabled &&
65+
getItemFromLocalStorage(`${WALLET_LS_KEY}_stake_key`)
66+
) {
5667
const { pathname } = window.location;
5768
navigate(`/connected${pathname}`);
5869
}
59-
}, [isEnabled]);
70+
}, [isEnabled, error]);
6071

6172
return (
6273
<Background opacity={0.7}>

0 commit comments

Comments
 (0)