address selector: use cached reverses
This commit is contained in:
parent
b38aa8d01f
commit
6f492a4945
@ -56,6 +56,7 @@ class AddressSelect extends Component {
|
|||||||
contacts: PropTypes.object,
|
contacts: PropTypes.object,
|
||||||
contracts: PropTypes.object,
|
contracts: PropTypes.object,
|
||||||
tokens: PropTypes.object,
|
tokens: PropTypes.object,
|
||||||
|
reverse: PropTypes.object,
|
||||||
|
|
||||||
// Optional props
|
// Optional props
|
||||||
allowCopy: PropTypes.bool,
|
allowCopy: PropTypes.bool,
|
||||||
@ -584,10 +585,12 @@ class AddressSelect extends Component {
|
|||||||
function mapStateToProps (state) {
|
function mapStateToProps (state) {
|
||||||
const { accountsInfo } = state.personal;
|
const { accountsInfo } = state.personal;
|
||||||
const { balances } = state.balances;
|
const { balances } = state.balances;
|
||||||
|
const { reverse } = state.registry;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accountsInfo,
|
accountsInfo,
|
||||||
balances
|
balances,
|
||||||
|
reverse
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,29 @@ export default class AddressSelectStore {
|
|||||||
@observable registryValues = [];
|
@observable registryValues = [];
|
||||||
|
|
||||||
initValues = [];
|
initValues = [];
|
||||||
regLookups = [];
|
regLookups = [
|
||||||
|
(address) => {
|
||||||
|
const name = this.reverse[address];
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
address,
|
||||||
|
name,
|
||||||
|
description: (
|
||||||
|
<FormattedMessage
|
||||||
|
id='addressSelect.fromRegistry'
|
||||||
|
defaultMessage='{name} (from registry)'
|
||||||
|
values={ {
|
||||||
|
name
|
||||||
|
} }
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
constructor (api) {
|
constructor (api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
@ -114,7 +136,8 @@ export default class AddressSelectStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@action setValues (props) {
|
@action setValues (props) {
|
||||||
const { accounts = {}, contracts = {}, contacts = {} } = props;
|
const { accounts = {}, contracts = {}, contacts = {}, reverse = {} } = props;
|
||||||
|
this.reverse = reverse;
|
||||||
|
|
||||||
const accountsN = Object.keys(accounts).length;
|
const accountsN = Object.keys(accounts).length;
|
||||||
const contractsN = Object.keys(contracts).length;
|
const contractsN = Object.keys(contracts).length;
|
||||||
|
Loading…
Reference in New Issue
Block a user