From 633b21386933020f4cb6e07a8e49f8a3fa3bde3b Mon Sep 17 00:00:00 2001 From: Mael Date: Tue, 9 Jul 2019 10:57:36 +0200 Subject: [PATCH] :bug: Affichage d'une valeur quand elle est nulle --- source/components/Value.js | 21 +++++++++++---------- source/components/rule/Rule.js | 1 - 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/source/components/Value.js b/source/components/Value.js index b77426381..ba1e9c41d 100644 --- a/source/components/Value.js +++ b/source/components/Value.js @@ -39,6 +39,17 @@ export default withLanguage( }) => { /* Either an entire rule object is passed, or just the right attributes and the value as a JSX child*/ let nodeValue = value === undefined ? children : value + + if ( + (nilValueSymbol !== undefined && nodeValue === 0) || + Number.isNaN(nodeValue) || + nodeValue === null + ) + return ( + + - + + ) let valueType = typeof nodeValue, unitText = unit !== null && (typeof unit == 'object' ? serialiseUnit(unit) : unit), @@ -59,16 +70,6 @@ export default withLanguage( ) - if ( - (nilValueSymbol !== undefined && nodeValue === 0) || - Number.isNaN(nodeValue) - ) - return ( - - - - - ) - return nodeValue == undefined ? null : ( {negative ? '-' : ''} diff --git a/source/components/rule/Rule.js b/source/components/rule/Rule.js index 06d95de47..a19a656cd 100644 --- a/source/components/rule/Rule.js +++ b/source/components/rule/Rule.js @@ -63,7 +63,6 @@ export default compose( namespaceRules = findRuleByNamespace(flatRules, dottedName) let displayedRule = analysedExample || analysedRule - console.log('dr', displayedRule) return ( <> {this.state.viewSource ? (