Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ changes.

### Fixed

- Fix missing redirect to outcomes on wallet disconnected state [Issue 3230](https://github.com/IntersectMBO/govtool/issues/3230)

### Changed

### Removed
Expand Down
19 changes: 15 additions & 4 deletions govtool/frontend/src/pages/GovernanceActionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {
generatePath,
} from "react-router-dom";
import { Box, CircularProgress, Link } from "@mui/material";
import { AxiosError } from "axios";

import { Background, Typography } from "@atoms";
import { ICONS, PATHS } from "@consts";
import { ICONS, OUTCOMES_PATHS, PATHS } from "@consts";
import { useCardano } from "@context";
import {
useGetProposalQuery,
Expand Down Expand Up @@ -45,18 +46,28 @@ export const GovernanceActionDetails = () => {
const fullProposalId = txHash && getFullGovActionId(txHash, index);
const shortenedGovActionId = txHash && getShortenedGovActionId(txHash, index);

const { data, isLoading } = useGetProposalQuery(
const { data, isLoading, error } = useGetProposalQuery(
fullProposalId ?? "",
!state?.proposal,
);
const proposal = (data ?? state)?.proposal;

useEffect(() => {
if (isEnabled && getItemFromLocalStorage(`${WALLET_LS_KEY}_stake_key`)) {
const isProposalNotFound =
(error as AxiosError)?.response?.data ===
`Proposal with id: ${fullProposalId} not found`;
if (isProposalNotFound && fullProposalId) {
navigate(
OUTCOMES_PATHS.governanceActionOutcomes.replace(":id", fullProposalId),
);
} else if (
isEnabled &&
getItemFromLocalStorage(`${WALLET_LS_KEY}_stake_key`)
) {
const { pathname } = window.location;
navigate(`/connected${pathname}`);
}
}, [isEnabled]);
}, [isEnabled, error]);

return (
<Background opacity={0.7}>
Expand Down