Skip to content

Commit

Permalink
Return not found page for undecoded proposal
Browse files Browse the repository at this point in the history
  • Loading branch information
Anboias committed Dec 6, 2024
1 parent c01babe commit f67bd1c
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BigNumber, utils } from 'ethers';
import { ComponentProps, useEffect, useMemo, useState } from 'react';
import { useEnsName, Address } from 'wagmi';
import { useHistory, useParams } from 'react-router';
import { useParams } from 'react-router';
import { Link } from 'react-router-dom';
import classNames from 'classnames';
import { Proposal, ProposalType, useChainData, VOTER_STATES } from '../../../chain-data';
Expand All @@ -23,6 +23,7 @@ import ProposalStatus from '../proposal-list/proposal-status';
import globalStyles from '../../../styles/global-styles.module.scss';
import styles from './proposal-details.module.scss';
import { canVoteSelector } from '../../../logic/proposals/selectors';
import NotFoundPage from '../../not-found';
import { handleTransactionError, images, messages, useScrollToTop } from '../../../utils';
import ExternalLink from '../../../components/external-link';

Expand Down Expand Up @@ -78,13 +79,9 @@ interface RouterParameters {
const ProposalDetailsPage = () => {
useScrollToTop();
const { typeAndVoteId } = useParams<RouterParameters>();
const { push } = useHistory();
const decoded = useMemo(() => decodeProposalTypeAndVoteId(typeAndVoteId), [typeAndVoteId]);

if (!decoded) {
push('/404');
return null;
}
if (!decoded) return <NotFoundPage />;

return <ProposalDetailsLayout {...decoded} />;
};
Expand Down

0 comments on commit f67bd1c

Please sign in to comment.