mirror of
https://github.com/trezor/trezor-wallet
synced 2024-12-29 10:28:08 +00:00
move saving SessionStorage from component to SelectedAccountAction
This commit is contained in:
parent
13a9e47c73
commit
6405c13da8
@ -7,6 +7,9 @@ import * as SEND from 'actions/constants/send';
|
|||||||
import * as NOTIFICATION from 'actions/constants/notification';
|
import * as NOTIFICATION from 'actions/constants/notification';
|
||||||
import * as PENDING from 'actions/constants/pendingTx';
|
import * as PENDING from 'actions/constants/pendingTx';
|
||||||
|
|
||||||
|
import * as SendFormActions from 'actions/SendFormActions';
|
||||||
|
import * as SessionStorageActions from 'actions/SessionStorageActions';
|
||||||
|
|
||||||
import * as stateUtils from 'reducers/utils';
|
import * as stateUtils from 'reducers/utils';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
@ -16,7 +19,7 @@ import type {
|
|||||||
Dispatch,
|
Dispatch,
|
||||||
State,
|
State,
|
||||||
} from 'flowtype';
|
} from 'flowtype';
|
||||||
import * as SendFormActions from './SendFormActions';
|
|
||||||
|
|
||||||
|
|
||||||
export type SelectedAccountAction = {
|
export type SelectedAccountAction = {
|
||||||
@ -42,6 +45,10 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
|
|||||||
// SessionStorageActions.clear(location.pathname);
|
// SessionStorageActions.clear(location.pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prevState.sendForm !== state.sendForm) {
|
||||||
|
dispatch( SessionStorageActions.save() );
|
||||||
|
}
|
||||||
|
|
||||||
// handle devices state change (from trezor-connect events or location change)
|
// handle devices state change (from trezor-connect events or location change)
|
||||||
if (locationChange
|
if (locationChange
|
||||||
|| prevState.accounts !== state.accounts
|
|| prevState.accounts !== state.accounts
|
||||||
|
@ -7,7 +7,6 @@ import { connect } from 'react-redux';
|
|||||||
|
|
||||||
import { reconnect } from 'actions/DiscoveryActions';
|
import { reconnect } from 'actions/DiscoveryActions';
|
||||||
import SendFormActions from 'actions/SendFormActions';
|
import SendFormActions from 'actions/SendFormActions';
|
||||||
import * as SessionStorageActions from 'actions/SessionStorageActions';
|
|
||||||
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
||||||
import type { State, Dispatch } from 'flowtype';
|
import type { State, Dispatch } from 'flowtype';
|
||||||
import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from 'views/Wallet/components/SelectedAccount';
|
import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from 'views/Wallet/components/SelectedAccount';
|
||||||
@ -24,7 +23,6 @@ export type StateProps = BaseStateProps & {
|
|||||||
|
|
||||||
export type DispatchProps = BaseDispatchProps & {
|
export type DispatchProps = BaseDispatchProps & {
|
||||||
sendFormActions: typeof SendFormActions,
|
sendFormActions: typeof SendFormActions,
|
||||||
saveSessionStorage: typeof SessionStorageActions.save
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Props = StateProps & BaseStateProps & DispatchProps & BaseDispatchProps;
|
export type Props = StateProps & BaseStateProps & DispatchProps & BaseDispatchProps;
|
||||||
@ -43,7 +41,6 @@ const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: St
|
|||||||
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
|
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
|
||||||
blockchainReconnect: bindActionCreators(reconnect, dispatch),
|
blockchainReconnect: bindActionCreators(reconnect, dispatch),
|
||||||
sendFormActions: bindActionCreators(SendFormActions, dispatch),
|
sendFormActions: bindActionCreators(SendFormActions, dispatch),
|
||||||
saveSessionStorage: bindActionCreators(SessionStorageActions.save, dispatch),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(AccountSend);
|
export default connect(mapStateToProps, mapDispatchToProps)(AccountSend);
|
@ -180,8 +180,6 @@ class AccountSend extends Component<Props, State> {
|
|||||||
componentWillReceiveProps(newProps: Props) {
|
componentWillReceiveProps(newProps: Props) {
|
||||||
calculate(this.props, newProps);
|
calculate(this.props, newProps);
|
||||||
validation(newProps);
|
validation(newProps);
|
||||||
|
|
||||||
this.props.saveSessionStorage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAddressInputState(address: string, addressErrors: string, addressWarnings: string) {
|
getAddressInputState(address: string, addressErrors: string, addressWarnings: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user