Skip to content

Commit

Permalink
Fix primefaces#5916: Splitter state storage fix
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Feb 11, 2024
1 parent d8aead8 commit 0641999
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions components/lib/splitter/Splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,24 +187,18 @@ export const Splitter = React.memo(
};

const onResizeEnd = (event) => {
setPanelSizes((prev) => {
const sizes = [];

for (let index = 0; index < props.children.length; index++) sizes[index] = panelSize(prev, index);
sizes[prevPanelIndex.current] = prevPanelSizeNew.current;
sizes[prevPanelIndex.current + 1] = nextPanelSizeNew.current;

if (props.onResizeEnd) {
props.onResizeEnd({
originalEvent: event,
sizes
});
}
const sizes = [prevPanelSizeNew.current, nextPanelSizeNew.current];

if (props.onResizeEnd) {
props.onResizeEnd({
originalEvent: event,
sizes
});
}

if (isStateful) saveState(sizes);
if (isStateful) saveState(sizes);

return sizes;
});
setPanelSizes(sizes);

!isUnstyled() && DomHandler.removeClass(gutterRef.current, 'p-splitter-gutter-resizing');
gutterRefs.current && Object.keys(gutterRefs.current).forEach((key) => gutterRefs.current[key].setAttribute('data-p-splitter-gutter-resizing', false));
Expand Down

0 comments on commit 0641999

Please sign in to comment.