Skip to content

Commit

Permalink
feat: timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
yongenaelf committed Nov 15, 2024
1 parent 55fac63 commit e2b2e22
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions components/workspace/use-cli-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ function CheckProposalId({ id }: { id: string }) {

function CheckProposalInfo({ id }: { id: string }) {
const [releasedTxId, setReleasedTxId] = useState<string>();
const [timedOut, setTimedOut] = useState(false);

const {data, loading} = useProposalsInfo(
[id],
Expand All @@ -376,6 +377,16 @@ function CheckProposalInfo({ id }: { id: string }) {
setReleasedTxId(releasedTxId);
}, [loading]);

useEffect(() => {
setTimedOut(false);
const timer = setTimeout(() => {
setTimedOut(true);
}, 120000);
return () => clearTimeout(timer);
}, [id])

if (timedOut) return <p>Timed out. Please check the status later.</p>;

return (
<>
<p>Proposal status: {releasedTxId ? 'released' : 'pending'}</p>
Expand Down

0 comments on commit e2b2e22

Please sign in to comment.