move saving SessionStorage from component to SelectedAccountAction

pull/69/head
Szymon Lesisz 6 years ago
parent 13a9e47c73
commit 6405c13da8

@ -7,6 +7,9 @@ import * as SEND from 'actions/constants/send';
import * as NOTIFICATION from 'actions/constants/notification';
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 type {
@ -16,7 +19,7 @@ import type {
Dispatch,
State,
} from 'flowtype';
import * as SendFormActions from './SendFormActions';
export type SelectedAccountAction = {
@ -42,6 +45,10 @@ export const updateSelectedValues = (prevState: State, action: Action): AsyncAct
// SessionStorageActions.clear(location.pathname);
}
if (prevState.sendForm !== state.sendForm) {
dispatch( SessionStorageActions.save() );
}
// handle devices state change (from trezor-connect events or location change)
if (locationChange
|| prevState.accounts !== state.accounts

@ -7,7 +7,6 @@ import { connect } from 'react-redux';
import { reconnect } from 'actions/DiscoveryActions';
import SendFormActions from 'actions/SendFormActions';
import * as SessionStorageActions from 'actions/SessionStorageActions';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype';
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 & {
sendFormActions: typeof SendFormActions,
saveSessionStorage: typeof SessionStorageActions.save
}
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 => ({
blockchainReconnect: bindActionCreators(reconnect, dispatch),
sendFormActions: bindActionCreators(SendFormActions, dispatch),
saveSessionStorage: bindActionCreators(SessionStorageActions.save, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(AccountSend);

@ -180,8 +180,6 @@ class AccountSend extends Component<Props, State> {
componentWillReceiveProps(newProps: Props) {
calculate(this.props, newProps);
validation(newProps);
this.props.saveSessionStorage();
}
getAddressInputState(address: string, addressErrors: string, addressWarnings: string) {

Loading…
Cancel
Save