<commit_before>import React from 'react';
import PuzzleNav from './PuzzleNav'


require("../../styles/puzzle-page.scss");

class PuzzlePage extends React.Component {

    constructor() {
        super();
        this.state = {
            puzzleComponent: null
        }

    }

    resetPuzzle() {
        this.refs.puzzle.reset();
    }

    componentWillMount() {
        let PuzzleLoad = require("bundle!./puzzles/" + this.props.params.title);
        PuzzleLoad((module) => {
            this.setState({puzzleComponent: module})
        });
    }

    render() {
        let Puzzle = this.state.puzzleComponent;

        return (
            <div>
                <PuzzleNav title={Puzzle ? Puzzle.title : "Loading..."} onReset={this.resetPuzzle}/>
                {Puzzle ? <Puzzle ref="puzzle"/> : ""}
            </div>
        );

    }
}



export default PuzzlePage;<commit_msg>fix reset problem after code splitig and lazy loading<commit_after>import React from 'react';
import PuzzleNav from './PuzzleNav'


require("../../styles/puzzle-page.scss");

class PuzzlePage extends React.Component {

    constructor() {
        super();
        this.state = {
            puzzleComponent: null,
            resetFunc: null
        }

    }

    resetPuzzle() {
        if (this.refs.puzzle) {
            this.refs.puzzle.reset();
        }
    }

    componentWillMount() {
        let PuzzleLoad = require("bundle!./puzzles/" + this.props.params.title);
        PuzzleLoad((module) => {
            this.setState({puzzleComponent: module})
        });
    }

    render() {
        let Puzzle = this.state.puzzleComponent;
        return (
            <div>
                <PuzzleNav title={Puzzle ? Puzzle.title : "Loading..."}
                           onReset={this.resetPuzzle.bind(this)}/>
                {Puzzle ? <Puzzle ref="puzzle"/> : ""}
            </div>
        );

    }
}



export default PuzzlePage;
{'fraction_non_alphanumeric': 0.1393782383419689, 'fraction_numerical': 0.0, 'mean_word_length': 1.782420749279539, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2479256', 'n_tokens_mistral': 616, 'n_tokens_neox': 551, 'n_words': 103}