From 9de779155390e1a54f0bc35409c5ba4d1ee39e9e Mon Sep 17 00:00:00 2001 From: user Date: Sat, 28 Feb 2026 12:17:52 -0800 Subject: [PATCH] fix: reset validation state when navigating to send view Clear the error/warning text and disable the review button when entering the send view from home, address detail, or address token views. This prevents stale validation messages from persisting after leaving and returning to the send view. --- src/popup/views/addressDetail.js | 7 ++++++- src/popup/views/addressToken.js | 7 ++++++- src/popup/views/home.js | 7 ++++++- src/popup/views/send.js | 17 ++++++++++++++++- 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/popup/views/addressDetail.js b/src/popup/views/addressDetail.js index 3c65e24..49c627e 100644 --- a/src/popup/views/addressDetail.js +++ b/src/popup/views/addressDetail.js @@ -15,7 +15,11 @@ const { filterTransactions, } = require("../../shared/transactions"); const { resolveEnsNames } = require("../../shared/ens"); -const { updateSendBalance, renderSendTokenSelect } = require("./send"); +const { + updateSendBalance, + renderSendTokenSelect, + resetSendValidation, +} = require("./send"); const { log } = require("../../shared/log"); const makeBlockie = require("ethereum-blockies-base64"); const { decryptWithPassword } = require("../../shared/vault"); @@ -259,6 +263,7 @@ function init(_ctx) { $("send-token").classList.remove("hidden"); $("send-token-static").classList.add("hidden"); updateSendBalance(); + resetSendValidation(); showView("send"); }); diff --git a/src/popup/views/addressToken.js b/src/popup/views/addressToken.js index 6f25fef..72c95c0 100644 --- a/src/popup/views/addressToken.js +++ b/src/popup/views/addressToken.js @@ -23,7 +23,11 @@ const { filterTransactions, } = require("../../shared/transactions"); const { resolveEnsNames } = require("../../shared/ens"); -const { updateSendBalance, renderSendTokenSelect } = require("./send"); +const { + updateSendBalance, + renderSendTokenSelect, + resetSendValidation, +} = require("./send"); const { log } = require("../../shared/log"); const makeBlockie = require("ethereum-blockies-base64"); @@ -372,6 +376,7 @@ function init(_ctx) { }); } updateSendBalance(); + resetSendValidation(); showView("send"); }); diff --git a/src/popup/views/home.js b/src/popup/views/home.js index 1b24d13..ea923e0 100644 --- a/src/popup/views/home.js +++ b/src/popup/views/home.js @@ -11,7 +11,11 @@ const { truncateMiddle, } = require("./helpers"); const { state, saveState, currentAddress } = require("../../shared/state"); -const { updateSendBalance, renderSendTokenSelect } = require("./send"); +const { + updateSendBalance, + renderSendTokenSelect, + resetSendValidation, +} = require("./send"); const { deriveAddressFromXpub } = require("../../shared/wallet"); const { formatUsd, @@ -388,6 +392,7 @@ function init(ctx) { $("send-token-static").classList.add("hidden"); renderSendTokenSelect(addr); updateSendBalance(); + resetSendValidation(); showView("send"); }); diff --git a/src/popup/views/send.js b/src/popup/views/send.js index 7400e93..6778405 100644 --- a/src/popup/views/send.js +++ b/src/popup/views/send.js @@ -276,4 +276,19 @@ function init(_ctx) { }); } -module.exports = { init, updateSendBalance, renderSendTokenSelect }; +function resetSendValidation() { + const errorEl = $("send-to-error"); + const btn = $("btn-send-review"); + if (errorEl) errorEl.textContent = ""; + if (btn) { + btn.disabled = true; + btn.classList.add("opacity-50"); + } +} + +module.exports = { + init, + updateSendBalance, + renderSendTokenSelect, + resetSendValidation, +};