From 932bbe43dc5e7705ccc64a47c418711933a68590 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Fri, 30 Nov 2018 10:51:11 +0530 Subject: [PATCH] SplitPane: fix retaining both width/height on pane bug --- src/components/SplitPane.jsx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/components/SplitPane.jsx b/src/components/SplitPane.jsx index de87362..4f1ddac 100644 --- a/src/components/SplitPane.jsx +++ b/src/components/SplitPane.jsx @@ -5,7 +5,11 @@ export class SplitPane extends Component { componentDidMount() { this.updateSplit(); } - + componentWillUpdate() { + if (this.splitInstance) { + this.splitInstance.destroy(); + } + } componentDidUpdate(prevProps) { if (this.hasGutter() && !this.hasPropsChanged(prevProps, this.props)) { return; @@ -33,13 +37,8 @@ export class SplitPane extends Component { const { children, ...options } = this.props; options.gutterSize = 6; - if (this.splitInstance && this.hasGutter()) { - this.splitInstance.destroy(); - } - /* eslint-disable new-cap */ this.splitInstance = Split([...this.parent.children], options); - console.log('recreating split'); /* eslint-enable new-cap */