Skip to content

Commit

Permalink
Small bug fix to guard against saving an incorrect panel layout to lo…
Browse files Browse the repository at this point in the history
…cal storage
  • Loading branch information
bvaughn committed Dec 13, 2023
1 parent bce573c commit ab496d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/react-resizable-panels/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 1.0.0
## 1.0.1

- Small bug fix to guard against saving an incorrect panel layout to local storage

# 1.0.0

- Remove support for pixel-based Panel constraints; (props like `defaultSizePercentage` should now be `defaultSize`)
- Replaced `dataAttributes` prop with `...rest` prop that supports all HTML attributes
Expand Down
2 changes: 1 addition & 1 deletion packages/react-resizable-panels/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-resizable-panels",
"version": "1.0.0",
"version": "1.0.1",
"description": "React components for resizable panel groups/layouts",
"author": "Brian Vaughn <[email protected]>",
"license": "MIT",
Expand Down
4 changes: 3 additions & 1 deletion packages/react-resizable-panels/src/PanelGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ function PanelGroupWithForwardedRef({
debounceMap[autoSaveId] = debouncedSave;
}

debouncedSave(autoSaveId, panelDataArray, layout, storage);
// Clone panel data array before saving since this array is mutated.
// If we don't clone, we run the risk of saving the wrong panel and layout pair.
debouncedSave(autoSaveId, [...panelDataArray], layout, storage);
}
}, [autoSaveId, layout, storage]);

Expand Down

1 comment on commit ab496d8

@vercel
Copy link

@vercel vercel bot commented on ab496d8 Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.