fix: persist confirm-tx view across popup close/reopen
All checks were successful
check / check (push) Successful in 22s

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
This commit is contained in:
user
2026-02-28 12:25:55 -08:00
parent 9444b06b52
commit d2f7284975
2 changed files with 13 additions and 1 deletions

View File

@@ -75,6 +75,7 @@ const RESTORABLE_VIEWS = new Set([
"settings", "settings",
"settings-addtoken", "settings-addtoken",
"transaction", "transaction",
"confirm-tx",
"success-tx", "success-tx",
"error-tx", "error-tx",
]); ]);
@@ -134,6 +135,13 @@ function restoreView() {
fallbackView(); fallbackView();
} }
break; break;
case "confirm-tx":
if (state.viewData && state.viewData.pendingTx) {
confirmTx.show(state.viewData.pendingTx);
} else {
fallbackView();
}
break;
case "success-tx": case "success-tx":
if (state.viewData && state.viewData.hash) { if (state.viewData && state.viewData.hash) {
txStatus.renderSuccess(); txStatus.renderSuccess();

View File

@@ -18,7 +18,7 @@ const {
addressDotHtml, addressDotHtml,
escapeHtml, escapeHtml,
} = require("./helpers"); } = require("./helpers");
const { state } = require("../../shared/state"); const { state, saveState } = require("../../shared/state");
const { getSignerForAddress } = require("../../shared/wallet"); const { getSignerForAddress } = require("../../shared/wallet");
const { decryptWithPassword } = require("../../shared/vault"); const { decryptWithPassword } = require("../../shared/vault");
const { formatUsd, getPrice } = require("../../shared/prices"); const { formatUsd, getPrice } = require("../../shared/prices");
@@ -219,6 +219,10 @@ function show(txInfo) {
$("confirm-fee-amount").textContent = "Estimating..."; $("confirm-fee-amount").textContent = "Estimating...";
showView("confirm-tx"); showView("confirm-tx");
// Persist txInfo so the view survives popup close/reopen
state.viewData = { pendingTx: txInfo };
saveState();
estimateGas(txInfo); estimateGas(txInfo);
} }