diff --git a/src/js/actions/AbstractAccountActions.js b/src/js/actions/AbstractAccountActions.js index ed217ea5..95d228af 100644 --- a/src/js/actions/AbstractAccountActions.js +++ b/src/js/actions/AbstractAccountActions.js @@ -48,7 +48,7 @@ export const init = (): ThunkAction => { } } -export const update = (): ThunkAction => { +export const update = (initAccountAction: () => ThunkAction): ThunkAction => { return (dispatch: Dispatch, getState: GetState): void => { const { abstractAccount, @@ -57,7 +57,7 @@ export const update = (): ThunkAction => { const isLocationChanged: boolean = router.location.pathname !== abstractAccount.location; if (isLocationChanged) { dispatch( init() ); - return; + initAccountAction(); } } } diff --git a/src/js/actions/ReceiveActions.js b/src/js/actions/ReceiveActions.js index 6e4ab0ed..489f9edf 100644 --- a/src/js/actions/ReceiveActions.js +++ b/src/js/actions/ReceiveActions.js @@ -39,21 +39,6 @@ export const init = (): ThunkAction => { } } - -export const update = (): ThunkAction => { - return (dispatch: Dispatch, getState: GetState): void => { - const { - abstractAccount, - router - } = getState(); - - const isLocationChanged: boolean = router.location.pathname !== abstractAccount.location; - if (isLocationChanged) { - dispatch( init() ); - } - } -} - export const dispose = (): Action => { return { type: RECEIVE.DISPOSE @@ -119,7 +104,6 @@ export const showAddress = (address_n: Array): AsyncAction => { export default { init, - update, dispose, showAddress, showUnverifiedAddress diff --git a/src/js/actions/SendFormActions.js b/src/js/actions/SendFormActions.js index 3b40d627..cb6810c9 100644 --- a/src/js/actions/SendFormActions.js +++ b/src/js/actions/SendFormActions.js @@ -211,21 +211,6 @@ export const init = (): ThunkAction => { } } -export const update = (): ThunkAction => { - return (dispatch: Dispatch, getState: GetState): void => { - const { - abstractAccount, - router - } = getState(); - - const isLocationChanged: boolean = router.location.pathname !== abstractAccount.location; - if (isLocationChanged) { - dispatch( init() ); - return; - } - } -} - export const dispose = (): Action => { return { type: SEND.DISPOSE @@ -890,7 +875,6 @@ export const onSend = (): AsyncAction => { export default { init, - update, dispose, toggleAdvanced, diff --git a/src/js/actions/SummaryActions.js b/src/js/actions/SummaryActions.js index 776bfeed..346a2d30 100644 --- a/src/js/actions/SummaryActions.js +++ b/src/js/actions/SummaryActions.js @@ -36,22 +36,6 @@ export const init = (): ThunkAction => { } } - -export const update = (): ThunkAction => { - return (dispatch: Dispatch, getState: GetState): void => { - const { - abstractAccount, - router - } = getState(); - - const isLocationChanged: boolean = router.location.pathname !== abstractAccount.location; - if (isLocationChanged) { - dispatch( init() ); - return; - } - } -} - export const dispose = (): Action => { return { type: SUMMARY.DISPOSE diff --git a/src/js/components/wallet/Receive.js b/src/js/components/wallet/Receive.js index 0b76b09f..baba3fc5 100644 --- a/src/js/components/wallet/Receive.js +++ b/src/js/components/wallet/Receive.js @@ -58,7 +58,7 @@ const _render = (props: Props, state: AccountState): React$Element => { let address = `${account.address.substring(0, 20)}...`; let className = 'address hidden'; let button = ( - ); @@ -126,7 +126,6 @@ const mapDispatchToProps: MapDispatchToProps return { abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), initAccount: bindActionCreators(ReceiveActions.init, dispatch), - updateAccount: bindActionCreators(ReceiveActions.update, dispatch), disposeAccount: bindActionCreators(ReceiveActions.dispose, dispatch), showAddress: bindActionCreators(ReceiveActions.showAddress, dispatch), }; diff --git a/src/js/components/wallet/account/AbstractAccount.js b/src/js/components/wallet/account/AbstractAccount.js index 2a095813..99d4b774 100644 --- a/src/js/components/wallet/account/AbstractAccount.js +++ b/src/js/components/wallet/account/AbstractAccount.js @@ -8,7 +8,7 @@ import { findDevice } from '../../../utils/reducerUtils'; // import * as AbstractAccountActions from '../../actions/AbstractAccountActions'; import { default as AbstractAccountActions } from '../../../actions/AbstractAccountActions'; -import type { State, TrezorDevice } from '../../../flowtype'; +import type { State, TrezorDevice, Action, ThunkAction } from '../../../flowtype'; import type { Account } from '../../../reducers/AccountsReducer'; import type { Discovery } from '../../../reducers/DiscoveryReducer'; @@ -21,9 +21,8 @@ export type StateProps = { export type DispatchProps = { abstractAccountActions: typeof AbstractAccountActions, - initAccount: typeof AbstractAccountActions.init, - updateAccount: typeof AbstractAccountActions.update, - disposeAccount: typeof AbstractAccountActions.dispose, + initAccount: () => ThunkAction, + disposeAccount: () => Action, } export type Props = StateProps & DispatchProps; @@ -50,8 +49,8 @@ export default class AbstractAccount

extends Component return { abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), sendFormActions: bindActionCreators(SendFormActions, dispatch), - initAccount: bindActionCreators(SendFormActions.init, dispatch), - updateAccount: bindActionCreators(SendFormActions.update, dispatch), + initAccount: bindActionCreators(SendFormActions.init, dispatch), disposeAccount: bindActionCreators(SendFormActions.dispose, dispatch), }; } diff --git a/src/js/components/wallet/summary/index.js b/src/js/components/wallet/summary/index.js index 0e300674..20253ff5 100644 --- a/src/js/components/wallet/summary/index.js +++ b/src/js/components/wallet/summary/index.js @@ -25,9 +25,6 @@ type StateProps = BaseStateProps & { } type DispatchProps = BaseDispatchProps & { - initAccount: typeof SummaryActions.init, - updateAccount: typeof SummaryActions.update, - disposeAccount: typeof SummaryActions.dispose, onDetailsToggle: typeof SummaryActions.onDetailsToggle, addToken: typeof TokenActions.add, loadTokens: typeof TokenActions.load, @@ -54,8 +51,7 @@ const mapDispatchToProps: MapDispatchToProps return { abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), - initAccount: bindActionCreators(SummaryActions.init, dispatch), - updateAccount: bindActionCreators(SummaryActions.update, dispatch), + initAccount: bindActionCreators(SummaryActions.init, dispatch), disposeAccount: bindActionCreators(SummaryActions.dispose, dispatch), onDetailsToggle: bindActionCreators(SummaryActions.onDetailsToggle, dispatch),