<commit_before>function TreeNode(tree, parent_node, title, graph_node)
{
	this.tree = tree;
	this.parent_node = parent_node;
	this.title = title;
	this.graph_node = graph_node;
	this.children = [];
	this.dom = this.label = null;
	this.selected = false;
}

TreeNode.prototype.add_child = function(title)
{
	var tn = new TreeNode(this.tree, this, title, null);
	
	this.children.push(tn);
	this.rebuild_dom();
	
	return tn;
};

TreeNode.prototype.remove = function()
{
	if(!this.parent_node)
		return;
	
	var pc = this.parent_node.children;
	
	this.dom.remove();
	pc.splice(pc.indexOf(this), 1);<commit_msg>Fixed bug in treeview: Don't try to remove the dom element of a graph that isn't currently shown in the treeview. This can happen if a loop or a graph is deleted from a parent that is the active graph in the treeview but isn't open at the time.<commit_after>function TreeNode(tree, parent_node, title, graph_node)
{
	this.tree = tree;
	this.parent_node = parent_node;
	this.title = title;
	this.graph_node = graph_node;
	this.children = [];
	this.dom = this.label = null;
	this.selected = false;
}

TreeNode.prototype.add_child = function(title)
{
	var tn = new TreeNode(this.tree, this, title, null);
	
	this.children.push(tn);
	this.rebuild_dom();
	
	return tn;
};

TreeNode.prototype.remove = function()
{
	if(!this.parent_node)
		return;
	
	var pc = this.parent_node.children;
	
	if(this.dom)
		this.dom.remove();
	
	pc.splice(pc.indexOf(this), 1);
{'fraction_non_alphanumeric': 0.12843406593406592, 'fraction_numerical': 0.0013736263736263737, 'mean_word_length': 4.298181818181818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4768404', 'n_tokens_mistral': 535, 'n_tokens_neox': 508, 'n_words': 132}