From 04f6801c45af44246639be0fe27b0b0013ed7b00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hobza?= Date: Fri, 3 May 2024 14:00:17 +0200 Subject: [PATCH] feat: default to_upgrade value (#69) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomáš Hobza --- frontend/src/components/NewProposalForm.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/NewProposalForm.tsx b/frontend/src/components/NewProposalForm.tsx index 7e3e797d..b9fdec66 100644 --- a/frontend/src/components/NewProposalForm.tsx +++ b/frontend/src/components/NewProposalForm.tsx @@ -12,7 +12,7 @@ export default function NewProposalForm({ // State variables for the payload and to_upgrade const [payload, setPayload] = React.useState(""); - const [to_upgrade, setToUpgrade] = React.useState(""); + const [to_upgrade, setToUpgrade] = React.useState("0"); // Create a call to submit a proposal const calls = useMemo(() => { @@ -46,11 +46,13 @@ export default function NewProposalForm({ writeAsync() .then(() => { toast.success("Proposal submitted"); - setIsModalOpen(false); }) .catch((e) => { toast.error("Something went wrong"); console.error(e); + }) + .finally(() => { + setIsModalOpen(false); }); } @@ -69,6 +71,7 @@ export default function NewProposalForm({ id="#to_upgrade" className="w-full p-2 border rounded-lg border-slate-300" onChange={(e) => setToUpgrade(e.target.value)} + defaultValue={to_upgrade} > {/* Carmine 0 = amm, 1 = governance, 2 = CARM token, 3 = merkle tree root, 4 = no-op/signal vote */}