From 9bda15168510351d7200c002114e65ef5e367b55 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Wed, 14 Jun 2023 11:45:30 +0100 Subject: [PATCH] fix[devtools]: display NaN as string in values (#26947) ## Summary >Warning: Received NaN for the `children` attribute. If this is expected, cast the value to a string. Fixes this warning, when we try to display NaN as NaN in key-value list. --- .../src/devtools/views/Components/KeyValue.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js index ca2f623c1a4c1..ecfc3499795b5 100644 --- a/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js +++ b/packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js @@ -255,6 +255,8 @@ export default function KeyValue({ displayValue = 'null'; } else if (value === undefined) { displayValue = 'undefined'; + } else if (isNaN(value)) { + displayValue = 'NaN'; } let shouldDisplayValueAsLink = false;