<commit_before>import React, {Component} from 'react';
import PropTypes from 'prop-types';

import './GlobalErrorOverlay.css';
import {FrontEndErrorContainer} from './FrontEnd/FrontEndErrorContainer.react';

export default class GlobalErrorOverlay extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const {resolve, visible, error, toastsEnabled} = this.props;

        let frontEndErrors;
        if (toastsEnabled) {
            let errors = [];
            if (error.frontEnd.length) {
                errors = error.frontEnd;
            }

            error.backEnd.forEach(backEndError => {
                errors.push(backEndError);
            });

            frontEndErrors = (
                <FrontEndErrorContainer errors={errors} resolve={resolve} />
            );
        }
        return (
            <div>
                <div>{this.props.children}</div>
                <div className="dash-error-menu">
                    <div className={visible ? 'dash-fe-errors' : ''}>
                        {frontEndErrors}
                    </div>
                </div>
            </div>
        );
    }
}

GlobalErrorOverlay.propTypes = {
    children: PropTypes.object,
    resolve: PropTypes.func,
    visible: PropTypes.bool,
    error: PropTypes.object,
    toastsEnabled: PropTypes.any,
};
<commit_msg>clone data, don't mutate<commit_after>import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {concat} from 'ramda';

import './GlobalErrorOverlay.css';
import {FrontEndErrorContainer} from './FrontEnd/FrontEndErrorContainer.react';

export default class GlobalErrorOverlay extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        const {resolve, visible, error, toastsEnabled} = this.props;

        let frontEndErrors;
        if (toastsEnabled) {
            const errors = concat(
                error.frontEnd,
                error.backEnd
            );

            frontEndErrors = (
                <FrontEndErrorContainer errors={errors} resolve={resolve} />
            );
        }
        return (
            <div>
                <div>{this.props.children}</div>
                <div className="dash-error-menu">
                    <div className={visible ? 'dash-fe-errors' : ''}>
                        {frontEndErrors}
                    </div>
                </div>
            </div>
        );
    }
}

GlobalErrorOverlay.propTypes = {
    children: PropTypes.object,
    resolve: PropTypes.func,
    visible: PropTypes.bool,
    error: PropTypes.object,
    toastsEnabled: PropTypes.any,
};

{'fraction_non_alphanumeric': 0.1144578313253012, 'fraction_numerical': 0.0, 'mean_word_length': 1.790966386554622, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 22, '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': '971723', 'n_tokens_mistral': 704, 'n_tokens_neox': 697, 'n_words': 142}