a3398843c2
Frequently used; top in perf profile Most of the time, you already have the claim object in the current context. `selectClaimIsMineForUri` will retrieve the claim again, which is wasteful, even if it is memoized (looking up the cache still takes time). Break apart the logic and added the alternative `selectClaimIsMine` for faster lookup. Co-authored-by: infinite-persistence <inf.persistence@gmail.com>
20 lines
856 B
JavaScript
20 lines
856 B
JavaScript
import { connect } from 'react-redux';
|
|
import { doSendDraftTransaction, doSendTip } from 'redux/actions/wallet';
|
|
import { selectClaimForUri } from 'redux/selectors/claims';
|
|
import { doHideModal } from 'redux/actions/app';
|
|
import ModalConfirmTransaction from './view';
|
|
import { selectActiveChannelClaim, selectIncognito } from 'redux/selectors/app';
|
|
|
|
const select = (state, props) => ({
|
|
claim: selectClaimForUri(state, props.destination)(state),
|
|
activeChannelClaim: selectActiveChannelClaim(state),
|
|
incognito: selectIncognito(state),
|
|
});
|
|
|
|
const perform = (dispatch) => ({
|
|
closeModal: () => dispatch(doHideModal()),
|
|
sendToAddress: (address, amount) => dispatch(doSendDraftTransaction(address, amount)),
|
|
sendTip: (params, isSupport) => dispatch(doSendTip(params, isSupport)),
|
|
});
|
|
|
|
export default connect(select, perform)(ModalConfirmTransaction);
|