fix: Back from Settings never lands on Settings itself (closes #481)
check / check (push) Waiting to run
e2e / e2e-chrome (push) Waiting to run
e2e / e2e-firefox (push) Waiting to run

The recovery phrase and delete wallet screens take themselves off the
Back stack when left, so Settings, one of those screens, then the
settings gear leaves Settings under the Settings now showing. A reopened
popup restores the same stack, cut at the screen the gear left. Back
then showed Settings again and seemed to do nothing.

goBack() now skips any entry for the screen already showing before it
pops its target. Jest tests drive the gear and then Back for the
recovery phrase screen, once and twice over, for both delete screens,
and after a reopen.

Model: opus-5-5
This commit is contained in:
2026-10-07 03:00:00 +00:00
parent 4dafd88fad
commit 24b9cf4768
6 changed files with 74 additions and 15 deletions
+13 -2
View File
@@ -216,10 +216,21 @@ function pushCurrentView() {
// Pop the navigation stack and show the previous view. If the stack
// is empty, fall back to the main (home) view.
//
// An entry for the view already showing is skipped: landing on it would
// make Back seem to do nothing. Settings, the recovery phrase or delete
// wallet screen, then the gear leaves Settings under Settings, because that
// screen takes itself off the stack when left, and a reopened popup cuts it
// off the restored stack the same way
// (https://git.eeqj.de/sneak/AutistMask/issues/481).
function goBack() {
const stack = state.viewStack;
while (stack.length > 0 && stack[stack.length - 1] === state.currentView) {
stack.pop();
}
let target;
if (state.viewStack.length > 0) {
target = state.viewStack.pop();
if (stack.length > 0) {
target = stack.pop();
} else {
target = "main";
}