Skip to content

Commit 25c91ac

Browse files
authored
reintroduce toFixed changes from 2.0.16 removed in 2.0.17 (#512)
Add back this missing commit 379cb27 Fixes: #508 I've tested this locally by porting into a local example https://codesandbox.io/p/sandbox/react-resizable-panels-forked-kcrnc3?file=%2Fsrc%2FApp.js%3A7%2C1-8%2C1 and removed the change saw the bug and readded change gone, i did record a vidoe but i can't get around github stupid 10MB limits
1 parent 97b6d48 commit 25c91ac

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/react-resizable-panels/src/utils/adjustLayoutByDelta.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ export function adjustLayoutByDelta({
200200

201201
if (
202202
deltaApplied
203-
.toPrecision(3)
204-
.localeCompare(Math.abs(delta).toPrecision(3), undefined, {
203+
.toFixed(3)
204+
.localeCompare(Math.abs(delta).toFixed(3), undefined, {
205205
numeric: true,
206206
}) >= 0
207207
) {

packages/react-resizable-panels/src/utils/computePanelFlexBoxStyle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ export function computePanelFlexBoxStyle({
2727
// Initial render (before panels have registered themselves)
2828
// In order to support server rendering, fall back to default size if provided
2929
flexGrow =
30-
defaultSize != undefined ? defaultSize.toPrecision(precision) : "1";
30+
defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
3131
} else if (panelData.length === 1) {
3232
// Special case: Single panel group should always fill full width/height
3333
flexGrow = "1";
3434
} else {
35-
flexGrow = size.toPrecision(precision);
35+
flexGrow = size.toFixed(precision);
3636
}
3737

3838
return {

0 commit comments

Comments
 (0)