From 0a158b5d3b243b4c8fb8ca0fda074f369cb398ea Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Fri, 22 Nov 2024 17:47:58 +0000 Subject: [PATCH 1/2] fix: Add default value to custom nonce modal --- .../modals/customize-nonce/customize-nonce.component.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/components/app/modals/customize-nonce/customize-nonce.component.js b/ui/components/app/modals/customize-nonce/customize-nonce.component.js index 1d87cbd549b1..b6b2f82a096e 100644 --- a/ui/components/app/modals/customize-nonce/customize-nonce.component.js +++ b/ui/components/app/modals/customize-nonce/customize-nonce.component.js @@ -27,7 +27,9 @@ const CustomizeNonce = ({ updateCustomNonce, getNextNonce, }) => { - const [customNonce, setCustomNonce] = useState(''); + const defaultNonce = + customNonceValue || (typeof nextNonce === 'number' && nextNonce.toString()); + const [customNonce, setCustomNonce] = useState(defaultNonce); const t = useI18nContext(); return ( @@ -107,10 +109,7 @@ const CustomizeNonce = ({ type="number" data-testid="custom-nonce-input" min="0" - placeholder={ - customNonceValue || - (typeof nextNonce === 'number' && nextNonce.toString()) - } + placeholder={defaultNonce} onChange={(e) => { setCustomNonce(e.target.value); }} From a97d2d08213149127e1a1102e87cdc2b3343a073 Mon Sep 17 00:00:00 2001 From: Pedro Figueiredo Date: Mon, 25 Nov 2024 10:39:37 +0000 Subject: [PATCH 2/2] Update snapshot test --- .../customize-nonce/__snapshots__/customize-nonce.test.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/components/app/modals/customize-nonce/__snapshots__/customize-nonce.test.js.snap b/ui/components/app/modals/customize-nonce/__snapshots__/customize-nonce.test.js.snap index 020adaa0c952..4698963a26ec 100644 --- a/ui/components/app/modals/customize-nonce/__snapshots__/customize-nonce.test.js.snap +++ b/ui/components/app/modals/customize-nonce/__snapshots__/customize-nonce.test.js.snap @@ -86,7 +86,7 @@ exports[`Customize Nonce should match snapshot 1`] = ` min="0" placeholder="1" type="number" - value="" + value="1" />