Skip to content

Commit f5c249d

Browse files
authored
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.
1 parent a1723e1 commit f5c249d

File tree

1 file changed

+2
-0
lines changed
  • packages/react-devtools-shared/src/devtools/views/Components

1 file changed

+2
-0
lines changed

packages/react-devtools-shared/src/devtools/views/Components/KeyValue.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ export default function KeyValue({
255255
displayValue = 'null';
256256
} else if (value === undefined) {
257257
displayValue = 'undefined';
258+
} else if (isNaN(value)) {
259+
displayValue = 'NaN';
258260
}
259261

260262
let shouldDisplayValueAsLink = false;

0 commit comments

Comments
 (0)