Display '<empty>' for U8a which is isEmpty (not the default) (#716)
This commit is contained in:
parent
5785d71d90
commit
ba5ecc2205
@ -7,6 +7,7 @@ import './Params.css';
|
||||
import React from 'react';
|
||||
import { classes } from '@polkadot/ui-app/util';
|
||||
import { isNull, isUndefined, u8aToHex } from '@polkadot/util';
|
||||
import { U8a } from '@polkadot/types';
|
||||
|
||||
// import IdentityIcon from '@polkadot/ui-react/IdentityIcon';
|
||||
// import formatNumber from '@polkadot/ui-app/util/formatNumber';
|
||||
@ -150,13 +151,22 @@ function valueToText (type: string, value: any, swallowError: boolean = true, co
|
||||
// }
|
||||
// }
|
||||
|
||||
// dont' even ask, nested ?: ... really?
|
||||
return isNull(value) || isUndefined(value)
|
||||
? unknown
|
||||
: div(
|
||||
{},
|
||||
['Bytes', 'Data'].includes(type)
|
||||
? u8aToHex(value.toU8a(true), contentShorten ? 512 : -1)
|
||||
: value.toString()
|
||||
: (
|
||||
value instanceof U8a
|
||||
? (
|
||||
value.isEmpty
|
||||
? '<empty>'
|
||||
: value.toString()
|
||||
)
|
||||
: value.toString()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user