<commit_before>import React from "react";
import { IAppContext, AppContext } from "../modules/core/AppContext";
import { IHistoryContext } from "history-next/lib/HistoryContext";
import Expose from "./Expose/index";
import MainView from "./MainView/index";
import { PromiseFactory } from "../modules/StaticCache";

let PropTypes = React.PropTypes;

interface Props extends React.Props<any> {
    context: IAppContext;
}

export class AppContainer extends React.Component<Props, any> {
    private _disposeHistoryListener: () => void = null;

    constructor(props: Props, context: any) {
        super(props, context);
    }

    getChildContext() {
        return this.props.context;
    }

    getComponentForContext(context: IHistoryContext) {
        return context.pathname === "" ? Expose : MainView;
    }

    update(context: IHistoryContext) {
        const component = this.getComponentForContext(context);
        this.setState({ component: component });
    }

    componentWillMount() {
        let appContext = this.props.context;
        const history = appContext.services.history;

        history.start();
        this.update(history.current);

        this._disposeHistoryListener = history.listen(context => {<commit_msg>minor optimization<commit_after>import React from "react";
import { IAppContext, AppContext } from "../modules/core/AppContext";
import { IHistoryContext } from "history-next/lib/HistoryContext";
import Expose from "./Expose/index";
import MainView from "./MainView/index";
import { PromiseFactory } from "../modules/StaticCache";

let PropTypes = React.PropTypes;

interface Props extends React.Props<any> {
    context: IAppContext;
}

export class AppContainer extends React.Component<Props, any> {
    private _disposeHistoryListener: () => void = null;

    constructor(props: Props, context: any) {
        super(props, context);
        this.state = { component: null } as any;
    }

    getChildContext() {
        return this.props.context;
    }

    getComponentForContext(context: IHistoryContext) {
        return context.pathname === "" ? Expose : MainView;
    }

    update(context: IHistoryContext) {
        const component = this.getComponentForContext(context);
        this.setState({ component: component });
    }

    componentWillMount() {
        let appContext = this.props.context;
        const history = appContext.services.history;

        history.start();
        this.update(history.current);

        this._disposeHistoryListener = history.listen(context => {
{'fraction_non_alphanumeric': 0.11593059936908517, 'fraction_numerical': 0.0, 'mean_word_length': 3.396880415944541, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '3494714', 'n_tokens_mistral': 687, 'n_tokens_neox': 675, 'n_words': 162}