<commit_before>import * as React from "react";
import * as _ from "lodash";
import Session from "../Session";
import Job from "../Job";
import StatusLineComponent from "./StatusLineComponent";
import JobComponent from "./3_JobComponent";
import {KeyCode} from "../Enums";
import * as css from "./css/main";

interface Props {
    session: Session;
    isActive: boolean;
    activate: () => void;
}

interface State {
    vcsData?: VcsData;
    jobs?: Job[];
}

export default class SessionComponent extends React.Component<Props, State> {
    RENDER_JOBS_COUNT = 25;

    constructor(props: Props) {
        super(props);

        this.state = {
            vcsData: {isRepository: false},
            jobs: this.props.session.jobs,
        };
    }

    componentDidMount() {
        this.props.session
            .on("job", () => this.setState({jobs: this.props.session.jobs}))
            .on("vcs-data", (data: VcsData) => this.setState({vcsData: data}));
    }

    render() {
        const jobs = _.takeRight(this.state.jobs, this.RENDER_JOBS_COUNT).map((job: Job, index: number) =>
            <JobComponent key={job.id}
                          job={job}
                          hasLocusOfAttention={this.props.isActive && index === this.state.jobs.length - 1}/>
        );

        return (
            <div style={css.session(this.props.isActive)}
                 tabIndex={0}
                 onClickCapture={this.handleClick.bind(this)}
                 onKeyDownCapture={this.handleKeyDown.bind(this)}>

                <div style={css.jobs(this.props.isActive)}>{jobs}</div>
                <StatusLineComponent currentWorkingDirectory={this.props.session.directory}
                                     vcsData={this.state.vcsData}/>
            </div><commit_msg>Remove jobs from SessionComponent state.<commit_after>import * as React from "react";
import * as _ from "lodash";
import Session from "../Session";
import Job from "../Job";
import StatusLineComponent from "./StatusLineComponent";
import JobComponent from "./3_JobComponent";
import {KeyCode} from "../Enums";
import * as css from "./css/main";

interface Props {
    session: Session;
    isActive: boolean;
    activate: () => void;
}

interface State {
    vcsData: VcsData;
}

export default class SessionComponent extends React.Component<Props, State> {
    RENDER_JOBS_COUNT = 25;

    constructor(props: Props) {
        super(props);

        this.state = {
            vcsData: {isRepository: false},
        };
    }

    componentDidMount() {
        this.props.session
            .on("job", () => this.forceUpdate())
            .on("vcs-data", (data: VcsData) => this.setState({vcsData: data}));
    }

    render() {
        const jobs = _.takeRight(this.props.session.jobs, this.RENDER_JOBS_COUNT).map((job: Job, index: number) =>
            <JobComponent key={job.id}
                          job={job}
                          hasLocusOfAttention={this.props.isActive && index === this.props.session.jobs.length - 1}/>
        );

        return (
            <div style={css.session(this.props.isActive)}
                 tabIndex={0}
                 onClickCapture={this.handleClick.bind(this)}
                 onKeyDownCapture={this.handleKeyDown.bind(this)}>

                <div style={css.jobs(this.props.isActive)}>{jobs}</div>
                <StatusLineComponent currentWorkingDirectory={this.props.session.directory}
                                     vcsData={this.state.vcsData}/>
            </div>
{'fraction_non_alphanumeric': 0.13795061027533354, 'fraction_numerical': 0.002838489923360772, 'mean_word_length': 2.2065514103730663, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7128315', 'n_tokens_mistral': 1029, 'n_tokens_neox': 991, 'n_words': 204}