From d2f7284975d9fb66d04977381d5d297315efd145 Mon Sep 17 00:00:00 2001 From: user Date: Sat, 28 Feb 2026 12:25:55 -0800 Subject: [PATCH] fix: persist confirm-tx view across popup close/reopen The confirm-tx view was not in RESTORABLE_VIEWS, so closing and reopening the popup would fall back to the main view, losing the pending transaction confirmation. Save pendingTx data to state.viewData when showing confirm-tx and add confirm-tx to the set of restorable views with proper restore logic. Closes #77 --- src/popup/index.js | 8 ++++++++ src/popup/views/confirmTx.js | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/popup/index.js b/src/popup/index.js index 5a12180..76ad298 100644 --- a/src/popup/index.js +++ b/src/popup/index.js @@ -75,6 +75,7 @@ const RESTORABLE_VIEWS = new Set([ "settings", "settings-addtoken", "transaction", + "confirm-tx", "success-tx", "error-tx", ]); @@ -134,6 +135,13 @@ function restoreView() { fallbackView(); } break; + case "confirm-tx": + if (state.viewData && state.viewData.pendingTx) { + confirmTx.show(state.viewData.pendingTx); + } else { + fallbackView(); + } + break; case "success-tx": if (state.viewData && state.viewData.hash) { txStatus.renderSuccess(); diff --git a/src/popup/views/confirmTx.js b/src/popup/views/confirmTx.js index f11cf68..daf6bf1 100644 --- a/src/popup/views/confirmTx.js +++ b/src/popup/views/confirmTx.js @@ -18,7 +18,7 @@ const { addressDotHtml, escapeHtml, } = require("./helpers"); -const { state } = require("../../shared/state"); +const { state, saveState } = require("../../shared/state"); const { getSignerForAddress } = require("../../shared/wallet"); const { decryptWithPassword } = require("../../shared/vault"); const { formatUsd, getPrice } = require("../../shared/prices"); @@ -219,6 +219,10 @@ function show(txInfo) { $("confirm-fee-amount").textContent = "Estimating..."; showView("confirm-tx"); + // Persist txInfo so the view survives popup close/reopen + state.viewData = { pendingTx: txInfo }; + saveState(); + estimateGas(txInfo); }