fix: Back after reopening the popup lands on a blank screen, because goBack() never re-renders #268
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
goBack()(src/popup/views/helpers.js:132-143) callsshowView(target), which only toggleshiddenclasses and runs the leave handler. It re-renders nothing. The sole exception ismain, via_renderMain().src/popup/index.js:266-272renders onlyrenderWalletList()beforerestoreView(), so on a freshly opened popup every view other thanmainand the restored one is still the blank static template fromsrc/popup/index.html. Pressing Back onto any of them shows that blank template.Reproduction, with no secret-bearing view involved:
["main", "address"], current viewsettings.settingsrestores; the stack is unchanged, correctly.btn-settings-back,src/popup/views/settings.js:423).showView("address")unhidesview-addresswithaddress-fullempty andaddress-balancesshowing .Same for
address-token,receive,confirm-txandtransaction.Found by the independent review of #266. Pre-existing and strictly wider than #224, which addresses only views the popup may not reopen ONTO. Filtering the stack — correctly — does not help here, because every view in the reproduction is restorable; the stack is right and the rendering is missing.
No secret leaks: the screens are blank precisely because nothing is restored into them. This is a navigation defect.
Implementation requirements
show()and data guardsrestoreView()already uses, rather than only unhiding it.restoreView()does, not render empty.showView()— forward navigation already renders, and doing it twice risks double-fetching or clobbering in-progress state. The fix belongs on the Back path.Definition of done
address-token,receive,confirm-tx,transaction, demonstrated failing first.TODO.mdupdated in the same commit.make checkpasses.Fixed in #272.
The per-view dispatch and data guards move out of
restoreView()intosrc/popup/viewRouter.js;goBack()routes a popped view through the samerenderView()via a rendererindex.jsregisters withsetBackRenderer(). A popped view whose backing state is gone falls back to Home as the restore does. Views outsideRESTORABLE_VIEWSare declined and still merely unhidden — the restored stack is filtered against that set, so one can only be on the stack from the current page load, where forward navigation rendered it. Forward navigation is untouched.Verified: both new end-to-end cases demonstrated failing against the unmodified sources —
the address line reads "", expected "Wallet 1 — Address 1\n0xD50e..."— then green.make checkexit 0 (652 tests,script/test-verify-build18 cases, prettier clean);make test-e2eexit 0, 29/29.