Small app-RPC fixes (#60)
* Don't render invalid accountIndex * Don't try to decode null/undefined
This commit is contained in:
parent
9bc9bfd6fe
commit
07dd46442f
@ -40,7 +40,6 @@ class Account extends React.PureComponent<Props, State> {
|
||||
|
||||
render (): React$Node {
|
||||
const { className, defaultValue, isError, style, t } = this.props;
|
||||
const { publicKey } = this.state;
|
||||
|
||||
return (
|
||||
<div
|
||||
@ -59,22 +58,35 @@ class Account extends React.PureComponent<Props, State> {
|
||||
type='account'
|
||||
/>
|
||||
</div>
|
||||
<Labelled
|
||||
className='small'
|
||||
label={t('account.nonce', {
|
||||
defaultValue: 'with an index of'
|
||||
})}
|
||||
>
|
||||
<Nonce
|
||||
className='ui disabled dropdown selection'
|
||||
onChange={this.onChangeNonce}
|
||||
params={publicKey}
|
||||
/>
|
||||
</Labelled>
|
||||
{this.renderNonce()}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
renderNonce (): React$Node {
|
||||
const { t } = this.props;
|
||||
const { publicKey } = this.state;
|
||||
|
||||
if (!publicKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Labelled
|
||||
className='small'
|
||||
label={t('account.nonce', {
|
||||
defaultValue: 'with an index of'
|
||||
})}
|
||||
>
|
||||
<Nonce
|
||||
className='ui disabled dropdown selection'
|
||||
onChange={this.onChangeNonce}
|
||||
params={publicKey}
|
||||
/>
|
||||
</Labelled>
|
||||
);
|
||||
}
|
||||
|
||||
onChangeAccount = (publicKey: Uint8Array): void => {
|
||||
const { onChange } = this.props;
|
||||
|
||||
|
||||
@ -10,6 +10,10 @@ import isObject from '@polkadot/util/is/object';
|
||||
import isU8a from '@polkadot/util/is/u8a';
|
||||
|
||||
function resultToText (result: mixed): mixed {
|
||||
if (result === null || result === undefined) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (isU8a(result)) {
|
||||
// $FlowFixMe type has been determined
|
||||
return u8aToHex(result);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user