<commit_before>import { h, Component } from 'preact';
import Split from 'split.js';

export class SplitPane extends Component {
	componentDidMount() {
		this.updateSplit();
	}

	componentDidUpdate(prevProps) {
		if (this.hasGutter() && !this.hasPropsChanged(prevProps, this.props)) {
			return;
		}
		this.updateSplit();
	}
	componentWillUnmount() {
		this.splitInstance.destroy();
		delete this.splitInstance;
	}
	hasGutter() {
		return (
			[...this.parent.children].indexOf(
				this.parent.querySelector('.gutter')
			) !== -1
		);
	}
	hasPropsChanged(a, b) {
		return (
			a.direction !== b.direction ||
			(a.sizes && b.sizes && a.sizes.join('') !== b.sizes.join(''))
		);
	}
	updateSplit() {
		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 */

		if (this.props.onSplit) {
			this.props.onSplit(this.splitInstance);
		}
	}
	render() {
		/* eslint-disable no-unused-vars */
		const { children, ...props } = this.props;
		/* eslint-enable no-unused-vars */

		return (
			<div ref={el => (this.parent = el)} {...props}>
				{this.props.children}
			</div>
		);
	}
}
<commit_msg>SplitPane: fix retaining both width/height on pane bug<commit_after>import { h, Component } from 'preact';
import Split from 'split.js';

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;
		}
		this.updateSplit();
	}
	componentWillUnmount() {
		this.splitInstance.destroy();
		delete this.splitInstance;
	}
	hasGutter() {
		return (
			[...this.parent.children].indexOf(
				this.parent.querySelector('.gutter')
			) !== -1
		);
	}
	hasPropsChanged(a, b) {
		return (
			a.direction !== b.direction ||
			(a.sizes && b.sizes && a.sizes.join('') !== b.sizes.join(''))
		);
	}
	updateSplit() {
		const { children, ...options } = this.props;
		options.gutterSize = 6;

		/* eslint-disable new-cap */
		this.splitInstance = Split([...this.parent.children], options);

		/* eslint-enable new-cap */

		if (this.props.onSplit) {
			this.props.onSplit(this.splitInstance);
		}
	}
	render() {
		/* eslint-disable no-unused-vars */
		const { children, ...props } = this.props;
		/* eslint-enable no-unused-vars */

		return (
			<div ref={el => (this.parent = el)} {...props}>
				{this.props.children}
			</div>
		);
	}
}

{'fraction_non_alphanumeric': 0.1827205882352941, 'fraction_numerical': 0.0014705882352941176, 'mean_word_length': 3.2120743034055725, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2202135', 'n_tokens_mistral': 1070, 'n_tokens_neox': 958, 'n_words': 167}