1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-28 03:08:30 +00:00

dispose and initialization selectedAccount view

This commit is contained in:
Szymon Lesisz 2018-05-28 19:48:07 +02:00
parent 47af92ae2c
commit b67315e180

View File

@ -55,6 +55,20 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
|| prevState.pending !== state.pending
|| prevState.web3 !== state.web3) {
if (locationChange) {
if (prevLocation) {
// save form data to session storage
// TODO: move to state.sendForm on change event
if (prevLocation.state.send) {
SessionStorageActions.save(prevState.router.location.pathname, state.sendForm);
}
}
// dispose current account view
dispatch( dispose() );
}
const account = stateUtils.getSelectedAccount(state);
const network = stateUtils.getSelectedNetwork(state);
const discovery = stateUtils.getDiscoveryProcess(state);
@ -84,23 +98,9 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
type: ACCOUNT.UPDATE_SELECTED_ACCOUNT,
payload,
});
}
if (locationChange) {
if (prevLocation) {
// save form data to session storage
// TODO: move to state.sendForm on change event
if (prevLocation.state.send) {
SessionStorageActions.save(prevState.router.location.pathname, state.sendForm);
}
}
dispatch( dispose() );
}
if (needUpdate) {
if (location.state.send && state.sendForm.currency === "") {
// initialize SendFormReducer
if (location.state.send && getState().sendForm.currency === "") {
dispatch( SendFormActions.init( SessionStorageActions.load(location.pathname) ) );
}
}