<commit_before>Template.Cytoscape.rendered = function(options) {
    var self = this;
    self.graph = cytoscape({
        container: self.$('.cytoscape')[0]
    });
    this.autorun(function(){
        var data = Blaze.getData().fetch();
        var dataCollection = Blaze.getData().collection;
        for(var d in data){
            var current = data[d];
            var collection = self.graph.getElementById(current._id)
            var existing = collection.json();

            if(existing === undefined){
                current.data = current.data || {};
                current.data.id = current._id;
                self.graph.add(current);

            }else{
                delete existing.data.id;
                existing.data._id = current._id;
                existing.data.group = existing.group;
                if(!_.isEqual(existing.data, current)){
                    self.graph.remove(collection);
                }
            }
        }

        var collection = self.graph.collection("*");
        if(collection.length > data.length){
            var cData = collection.jsons();
            for(var c in cData){
                var cd = cData[c];
                if(dataCollection.findOne(cd.data._id) === undefined){
                    self.graph.elements().remove("#"+cd.data._id);
                }
            }
        }
        self.graph.elements().layout({ name: 'grid' });
    });
}
<commit_msg>added temporary force render solution<commit_after>Template.Cytoscape.rendered = function(options) {
    var self = this;
    self.graph = cytoscape({
        container: self.$('.cytoscape')[0]
    });
    this.autorun(function(){
        var data = Blaze.getData().fetch();
        var dataCollection = Blaze.getData().collection;
        for(var d in data){
            var current = data[d];
            var collection = self.graph.getElementById(current._id)
            var existing = collection.json();

            if(existing === undefined){
                current.data = current.data || {};
                current.data.id = current._id;
                self.graph.add(current);

            }else{
                delete existing.data.id;
                existing.data._id = current._id;
                existing.data.group = existing.group;
                if(!_.isEqual(existing.data, current)){
                    self.graph.remove(collection);
                }
            }
        }

        var collection = self.graph.collection("*");
        if(collection.length > data.length){
            var cData = collection.jsons();
            for(var c in cData){
                var cd = cData[c];
                if(dataCollection.findOne(cd.data._id) === undefined){
                    self.graph.elements().remove("#"+cd.data._id);
                    self.graph.forceRender();
                }
            }
        }
        self.graph.elements().layout({ name: 'grid' });
    });
}

{'fraction_non_alphanumeric': 0.13299319727891157, 'fraction_numerical': 0.0006802721088435374, 'mean_word_length': 1.535344827586207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6864506', 'n_tokens_mistral': 787, 'n_tokens_neox': 753, 'n_words': 139}