<commit_before>import React from 'react';

import Snackbar from 'material-ui/Snackbar';

import NotificationStore from '../../stores/NotificationStore';

export default class SnackbarNotification extends React.Component {

        constructor(props) {
            super(props);

            this.state = {
                message: null,
                count: 0,
            };

            // Set this variable to true to prevent message refresh before state has been updated
            this.preventMessage = false;

            // binding
            this._openMessageIfNecessary = this._openMessageIfNecessary.bind(this);
            this._handleRequestClose = this._handleRequestClose.bind(this);
        }

    componentDidMount() {
        // listen the store change
        NotificationStore.addChangeListener(this._onNotificationStoreChange.bind(this));
    }

    componentDidUpdate() {
        // Prevent message to show before end of transition
        setTimeout(() => {
            this.preventMessage = false;
            this._openMessageIfNecessary();
        }, 300);
    }

    _onNotificationStoreChange() {
        this._openMessageIfNecessary();
    }

    /**
     * Open the message if there is new notification in the store and if there is no notification currently
     */
    _openMessageIfNecessary() {
        console.log('ifnecessary')
        if(!this.state.message && !this.preventMessage) {
            let message = NotificationStore.shiftSnackbar();
            console.log(message);
            if(message) {
                // Enable notification
                this.preventMessage = true;
                this.setState({ message: message });
                console.log('Notification :', message);
            }
        }
    }


    _handleRequestClose() {
        this.setState({ message: null, count: this.state.count+1 });
    }


    render() {
        return (
            <Snackbar
                open={(this.state.message != null && this.preventMessage != null)}
                message={(this.state.message ? this.state.message : '')}
                autoHideDuration={3000}
                onRequestClose={this._handleRequestClose}
            />
        );
    }

}
<commit_msg>Remove useless debug console.log<commit_after>import React from 'react';

import Snackbar from 'material-ui/Snackbar';

import NotificationStore from '../../stores/NotificationStore';

export default class SnackbarNotification extends React.Component {

        constructor(props) {
            super(props);

            this.state = {
                message: null,
                count: 0,
            };

            // Set this variable to true to prevent message refresh before state has been updated
            this.preventMessage = false;

            // binding
            this._openMessageIfNecessary = this._openMessageIfNecessary.bind(this);
            this._handleRequestClose = this._handleRequestClose.bind(this);
        }

    componentDidMount() {
        // listen the store change
        NotificationStore.addChangeListener(this._onNotificationStoreChange.bind(this));
    }

    componentDidUpdate() {
        // Prevent message to show before end of transition
        setTimeout(() => {
            this.preventMessage = false;
            this._openMessageIfNecessary();
        }, 300);
    }

    _onNotificationStoreChange() {
        this._openMessageIfNecessary();
    }

    /**
     * Open the message if there is new notification in the store and if there is no notification currently
     */
    _openMessageIfNecessary() {
        if(!this.state.message && !this.preventMessage) {
            let message = NotificationStore.shiftSnackbar();
            if(message) {
                // Enable notification
                this.preventMessage = true;
                this.setState({ message: message });
                console.log('Notification :', message);
            }
        }
    }


    _handleRequestClose() {
        this.setState({ message: null, count: this.state.count+1 });
    }


    render() {
        return (
            <Snackbar
                open={(this.state.message != null && this.preventMessage != null)}
                message={(this.state.message ? this.state.message : '')}
                autoHideDuration={3000}
                onRequestClose={this._handleRequestClose}
            />
        );
    }

}

{'fraction_non_alphanumeric': 0.10027223230490018, 'fraction_numerical': 0.004083484573502722, 'mean_word_length': 1.8873608382449247, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4548149', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1062, 'n_words': 243}