mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 01:08:27 +00:00
fix Router service to allow LOCATION_CHANGE while popup is connected
but context device is disconnected
This commit is contained in:
parent
ad3237a49a
commit
241fc5acdc
@ -112,7 +112,10 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
// if web3 wasn't initialized yet or there are no devices attached or initialization error occurs
|
||||
const landingPage: boolean = web3.length < 1 || devices.length < 1 || error !== null;
|
||||
|
||||
if (isModalOpened && action.payload.pathname !== location.pathname) {
|
||||
// modal is still opened and currentPath is still valid
|
||||
// example 1 (valid blocking): url changes while passphrase modal opened but device is still connected (we want user to finish this action)
|
||||
// example 2 (invalid blocking): url changes while passphrase modal opened because device disconnect
|
||||
if (isModalOpened && action.payload.pathname !== location.pathname && validation(api, currentParams)) {
|
||||
redirectPath = location.pathname;
|
||||
console.warn("Modal still opened");
|
||||
} else if (landingPage) {
|
||||
@ -152,7 +155,7 @@ const RouterService: Middleware = (api: MiddlewareAPI) => (next: MiddlewareDispa
|
||||
}
|
||||
|
||||
if (redirectPath) {
|
||||
console.warn("Redirecting...")
|
||||
console.warn("Redirecting...", redirectPath)
|
||||
// override action to keep routerReducer sync
|
||||
const url: string = redirectPath;
|
||||
action.payload.state = pathToParams(url);
|
||||
|
Loading…
Reference in New Issue
Block a user