<commit_before>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import FlatButton from 'material-ui/FlatButton';
import AutoComplete from 'material-ui/AutoComplete';
import presentations from '../../../../data/presentations';
import { cloneDeep } from 'lodash';
import LogoWhite from '../../../../assets/logo-white.svg';
import './index.css';

class Adder extends Component {
    constructor(props) {
        super(props);

        this.state = {
            wpId: null,
            dataSource: [],
        }
    }

    componentDidMount() {
        presentations.list()
            .then(res=> this.setState({
                dataSource: res.map(single => {
                    return {
                        text: single.title,
                        value: single.id
                    }
                })
            }))
    }<commit_msg>Fix errors in adder<commit_after>import React, { Component } from 'react';
import PropTypes from 'prop-types';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import FlatButton from 'material-ui/FlatButton';
import AutoComplete from 'material-ui/AutoComplete';
import presentations from '../../../../data/presentations';
import { cloneDeep } from 'lodash';
import LogoWhite from '../../../../assets/logo-white.svg';
import './index.css';

class Adder extends Component {
    constructor(props) {
        super(props);

        this.state = {
            wpId: '',
            dataSource: [],
            title: '',
            authorName: '',
            version: '',
        };
    }

    componentDidMount() {
        this._isMounted = true;

        presentations.list()
            .then(res => {
                if(! this._isMounted) throw new Error('Not mounted');
                return res
            })
            .then(res => this.setState({
                dataSource: res.map(single => {
                    return {
                        text: single.title,
                        value: single.id
                    }
                })
            }))
          .catch(err => console.log(err))
    }

    componentWillUnmount() {
        this._isMounted = false
    }
{'fraction_non_alphanumeric': 0.13286713286713286, 'fraction_numerical': 0.0, 'mean_word_length': 1.6709451575262544, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4523', 'n_tokens_mistral': 599, 'n_tokens_neox': 575, 'n_words': 141}