<commit_before>import React from "react";
import connectToStores from "alt/utils/connectToStores";
import GwasActions from "../actions/GwasActions";
import GwasStore from "../stores/GwasStore";
import { Input, Button, Table, Alert, Grid, Row, Col, Image } from "react-bootstrap";
import { Link } from "react-router";
import Footer from "./Footer";
import TraitList from "./TraitList";
import Result from "./Result";

class App extends React.Component {
    static getStores() {
        return [GwasStore];
    }

    static getPropsFromStores() {
        return {
            results: GwasStore.getResults(),
        };
    }

    constructor(props) {
        super(props);
        this.onSearch = this.onSearch.bind(this);
        this.onClear = this.onClear.bind(this);
        this.onQueryChange = this.onQueryChange.bind(this);
        this.onCheckboxChange = this.onCheckboxChange.bind(this);

        this.state = {
            query: this.props.location.query.q || "",
            tromso: this.props.location.query.tromso || false,
        };
    }

    componentWillReceiveProps(nextProps) {
        const location = this.props.location;
        const newLocation = nextProps.location;
        const q = location.query.q;
        const newQ = newLocation.query.q;
        const tromso = location.query.tromso;
        const newTromso = newLocation.query.tromso === "true";
        if (q !== newQ || tromso !== newTromso) {
            this.setState({ query: newQ || "", tromso: newTromso || false });
            GwasActions.search(newQ, newTromso);
        }
    }

    onQueryChange(e) {
        this.setState({ query: e.target.value });
    }

    onCheckboxChange(e) {
        this.props.history.pushState(null, `/search/?q=${this.refs.query.getValue()}&tromso=${this.refs.tromso.getChecked()}`);
    }

    onSearch(e) {
        e.preventDefault();
        this.props.history.pushState(null, `/search/?q=${this.refs.query.getValue()}&tromso=${this.refs.tromso.getChecked()}`);
    }

    onClear() {
        this.props.history.pushState(null, `/search/?tromso=${this.refs.tromso.getChecked()}`);
    }

    renderResults() {
        if (!this.props.location.query.q) {
            return (
                <TraitList />
            );<commit_msg>Fix parameter difference check to avoid inifine searching<commit_after>import React from "react";
import connectToStores from "alt/utils/connectToStores";
import GwasActions from "../actions/GwasActions";
import GwasStore from "../stores/GwasStore";
import { Input, Button, Table, Alert, Grid, Row, Col, Image } from "react-bootstrap";
import { Link } from "react-router";
import Footer from "./Footer";
import TraitList from "./TraitList";
import Result from "./Result";

class App extends React.Component {
    static getStores() {
        return [GwasStore];
    }

    static getPropsFromStores() {
        return {
            results: GwasStore.getResults(),
        };
    }

    constructor(props) {
        super(props);
        this.onSearch = this.onSearch.bind(this);
        this.onClear = this.onClear.bind(this);
        this.onQueryChange = this.onQueryChange.bind(this);
        this.onCheckboxChange = this.onCheckboxChange.bind(this);

        this.state = {
            query: this.props.location.query.q || "",
            tromso: this.props.location.query.tromso || false,
        };
    }

    componentWillReceiveProps(nextProps) {
        const location = this.props.location;
        const newLocation = nextProps.location;
        const q = location.query.q;
        const newQ = newLocation.query.q;
        const tromso = location.query.tromso === "true";
        const newTromso = newLocation.query.tromso === "true";
        if (q !== newQ || tromso !== newTromso) {
            this.setState({ query: newQ || "", tromso: newTromso || false });
            GwasActions.search(newQ, newTromso);
        }
    }

    onQueryChange(e) {
        this.setState({ query: e.target.value });
    }

    onCheckboxChange(e) {
        this.props.history.pushState(null, `/search/?q=${this.refs.query.getValue()}&tromso=${this.refs.tromso.getChecked()}`);
    }

    onSearch(e) {
        e.preventDefault();
        this.props.history.pushState(null, `/search/?q=${this.refs.query.getValue()}&tromso=${this.refs.tromso.getChecked()}`);
    }

    onClear() {
        this.props.history.pushState(null, `/search/?tromso=${this.refs.tromso.getChecked()}`);
    }

    renderResults() {
        if (!this.props.location.query.q) {
            return (
                <TraitList />
            );
{'fraction_non_alphanumeric': 0.14585611196151324, 'fraction_numerical': 0.0, 'mean_word_length': 2.540247678018576, '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': '1267488', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1406, 'n_words': 256}