Skip to content

Commit 237735f

Browse files
committed
Go back to old number rounding to match vanilla in some edge cases
1 parent 2c3ac99 commit 237735f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/monitor-adapter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ export default function ({id, spriteName, opcode, params, value, vm}) {
2828
label = `${spriteName}: ${label}`;
2929
}
3030

31-
// If value is a normal finite number, round it to six decimal places.
32-
if (typeof value === 'number' && Number.isFinite(value) && !Object.is(value, -0)) {
33-
value = Math.round(value * 1e6) / 1e6;
31+
// If value is a normal, round it to six decimal places. -0 is handled in safeStringify, so don't break it here.
32+
if (typeof value === 'number' && !Object.is(value, -0)) {
33+
value = Number(value.toFixed(6));
3434
}
3535

3636
// Convert to a string now. That should help avoid unnecessary re-renders in a few edge cases.

0 commit comments

Comments
 (0)