Skip to content

Commit 99b6f31

Browse files
committed
fix: (#3230) missing redirect to outcomes on disconnected state
1 parent 2969712 commit 99b6f31

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

govtool/backend/example-config.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"dbsyncconfig" : {
3-
"host" : "localhost",
4-
"dbname" : "cexplorer",
5-
"user" : "postgres",
6-
"password" : "postgres",
7-
"port" : 5432
8-
},
9-
"port" : 9999,
10-
"host" : "localhost",
2+
"dbsyncconfig": {
3+
"host": "dbsync-v3.demeter.run",
4+
"dbname": "dbsync-preview",
5+
"user": "dbsync1655mhzeddsnxvn9l4kk",
6+
"password": "NOkkAfHFz8g",
7+
"port": 5432
8+
},
9+
"port": 9999,
10+
"host": "localhost",
1111
"cachedurationseconds": 20,
1212
"sentrydsn": "https://username:[email protected]/id",
1313
"sentryenv": "dev"

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)