Skip to content

Commit

Permalink
Fix #3456: Splitter error with only 1 panel (#3549)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Nov 1, 2022
1 parent c1d458d commit 0d25917
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions components/lib/splitter/Splitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ export const Splitter = React.memo(
const [panelSizes, setPanelSizes] = React.useState([]);
const isStateful = props.stateKey != null;
const childrenLength = props.children && props.children.length;

const panelSize = (sizes, index) => (index in sizes ? sizes[index] : props.children[index].props.size || 100 / childrenLength);
const panelSize = (sizes, index) => (index in sizes ? sizes[index] : ((props.children[index] && props.children[index].props.size) || 100) / childrenLength);

const [bindDocumentMouseMoveListener, unbindDocumentMouseMoveListener] = useEventListener({ type: 'mousemove', listener: (event) => onResize(event) });
const [bindDocumentMouseUpListener, unbindDocumentMouseUpListener] = useEventListener({
Expand Down

0 comments on commit 0d25917

Please sign in to comment.