<commit_before>import * as React from 'react';
import { browserHistory } from 'react-router'
import { Container } from 'flux/utils';
import * as B from '../bulma';
import IssueAction from '../actions/IssueAction';
import IssueStore, { Issue, IssueQuery } from '../stores/IssueStore';
import IssueTable from '../components/IssueTable';
import SearchFilter from '../components/SearchFilter';

interface State {
    issues?: Issue[];
    query?: IssueQuery;
}

interface QueryString {
    keyword: string;
    filterByChecked: string;
}

class IssuesView extends React.Component<any, State> {
    static getStores() {
        return [IssueStore];
    }

    static calculateState(prevState: State) {
        const storeState = IssueStore.getState();
        const nextState = {
            issues: storeState.issues,
            query: storeState.query
        };

        // do search
        if (!prevState || prevState.query !== nextState.query) {
            // change browser url for bookmarkable search page
            const keyword = nextState.query.keyword;
            const filterByChecked = nextState.query.filterByChecked;
            // TODO resolve warning as below
            // warning.js:45 Warning: setState(...): Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.
            if (typeof window !== 'undefined') {
                browserHistory.push(`/?keyword=${keyword}&filterByChecked=${filterByChecked}`);
            }
        }

        return nextState;
    }

    componentDidMount() {
        const query = this.props.location.query as QueryString;
        this.fetchIssues(query.keyword, query.filterByChecked);
    }

    componentWillReceiveProps(nextProps) {
        const prevQuery = this.props.location.query;
        const query = nextProps.location.query;

        if (prevQuery.keyword !== query.keyword ||
            prevQuery.filterByChecked !== query.filterByChecked) {

            this.fetchIssues(query.keyword, query.filterByChecked);
        }
    }<commit_msg>Fix Home link<commit_after>import * as React from 'react';
import { browserHistory } from 'react-router'
import { Container } from 'flux/utils';
import * as B from '../bulma';
import IssueAction from '../actions/IssueAction';
import IssueStore, { Issue, IssueQuery } from '../stores/IssueStore';
import IssueTable from '../components/IssueTable';
import SearchFilter from '../components/SearchFilter';

interface State {
    issues?: Issue[];
    query?: IssueQuery;
}

interface QueryString {
    keyword: string;
    filterByChecked: string;
}

class IssuesView extends React.Component<any, State> {
    static getStores() {
        return [IssueStore];
    }

    static calculateState(prevState: State) {
        const storeState = IssueStore.getState();
        const nextState = {
            issues: storeState.issues,
            query: storeState.query
        };

        // do search
        if (!prevState || prevState.query !== nextState.query) {
            // change browser url for bookmarkable search page
            const keyword = nextState.query.keyword || '';
            const filterByChecked = nextState.query.filterByChecked;
            // TODO resolve warning as below
            // warning.js:45 Warning: setState(...): Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.
            if (typeof window !== 'undefined') {
                browserHistory.push(`/?keyword=${keyword}&filterByChecked=${filterByChecked}`);
            }
        }

        return nextState;
    }

    componentDidMount() {
        const query = this.props.location.query as QueryString;
        this.fetchIssues(query.keyword, query.filterByChecked);
    }

    componentWillReceiveProps(nextProps) {
        const prevQuery = this.props.location.query;
        const query = nextProps.location.query;

        if (prevQuery.keyword !== query.keyword ||
            prevQuery.filterByChecked !== query.filterByChecked) {

            this.fetchIssues(query.keyword, query.filterByChecked);
        }
    }
{'fraction_non_alphanumeric': 0.10883054892601432, 'fraction_numerical': 0.0009546539379474941, 'mean_word_length': 2.6285714285714286, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7197225', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1050, 'n_words': 298}