Improve monitor shouldComponentUpdate

- did not tell apart 0 and -0
- would always re-render if value was NaN
This commit is contained in:
Thomas Weber committed 2026-01-09 21:42:02 -06:00
1 parent 352845e5d7
commit 04dcb7dcf4
1 file changed
+2 -1
+2 -1
View File
@@ -91,7 +91,8 @@ class Monitor extends React.Component {
for (const key of Object.getOwnPropertyNames(nextProps)) {
// Don't need to rerender when other monitors are moved.
// monitorLayout is only used during initial layout.
if (key !== 'monitorLayout' && nextProps[key] !== this.props[key]) {
// Using Object.is to tell apart 0 and -0 and avoid unnecessary re-renders for NaN
if (key !== 'monitorLayout' && !Object.is(nextProps[key], this.props[key])) {
return true;
}
}