From ba5ecc2205caa5e764f3b97f4d89b60a3594fd3f Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Thu, 14 Feb 2019 13:26:23 +0100 Subject: [PATCH] Display '' for U8a which is isEmpty (not the default) (#716) --- packages/ui-params/src/valueToText.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/ui-params/src/valueToText.tsx b/packages/ui-params/src/valueToText.tsx index 8e1a049b5e..f84123e25a 100644 --- a/packages/ui-params/src/valueToText.tsx +++ b/packages/ui-params/src/valueToText.tsx @@ -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 + ? '' + : value.toString() + ) + : value.toString() + ) ); }