Skip to content

Commit

Permalink
fix: adgusted layout memo parent merge
Browse files Browse the repository at this point in the history
  • Loading branch information
flops committed Jul 10, 2024
1 parent 71b5795 commit 1866199
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/hocs/withContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,18 @@ function useMemoStateContext(props) {
const resultLayout = React.useMemo(() => {
return props.layout.map((item) => {
if (item.i in adjustedLayouts.current) {
return {
...adjustedLayouts.current[item.i],
w: item.w,
x: item.x,
y: item.y,
};
// eslint-disable-next-line no-unused-vars
const {parent, ...adjustedItem} = adjustedLayouts.current[item.i] || {};

adjustedItem.w = item.w;
adjustedItem.x = item.x;
adjustedItem.y = item.y;

if (item.parent) {
adjustedItem.parent = item.parent;
}

return adjustedItem;
} else {
return {...item};
}
Expand Down

0 comments on commit 1866199

Please sign in to comment.