<commit_before>import Component from 'flarum/Component';
import PostStream from 'flarum/components/PostStream';

export default class DiscussionPage extends Component {
  constructor(...args) {
    super(...args);

    /**
     * The discussion that is being viewed.
     *
     * @type {Discussion}
     */
    const discussion = this.discussion = app.preloadedDocument();

    let includedPosts = [];
    if (discussion.payload && discussion.payload.included) {
      includedPosts = discussion.payload.included
        .filter(record => record.type === 'posts' && record.relationships && record.relationships.discussion)
        .map(record => app.store.getById('posts', record.id))
        .sort((a, b) => a.id() - b.id())
        .slice(0, 20);
    }

    this.stream = new PostStream({discussion, includedPosts});
  }

  view() {
    return (
      <div className="DiscussionPage">
        <div class="container">
          <div className="DiscussionPage-discussion">
            <div className="DiscussionPage-stream">
              {this.stream.render()}
            </div>
          </div>
        </div>
      </div>
    );
  }
}
<commit_msg>Initialise component state in init() instead of constructor<commit_after>import Component from 'flarum/Component';
import PostStream from 'flarum/components/PostStream';

export default class DiscussionPage extends Component {
  init() {
    super.init();

    /**
     * The discussion that is being viewed.
     *
     * @type {Discussion}
     */
    const discussion = this.discussion = app.preloadedDocument();

    let includedPosts = [];
    if (discussion.payload && discussion.payload.included) {
      includedPosts = discussion.payload.included
        .filter(record => record.type === 'posts' && record.relationships && record.relationships.discussion)
        .map(record => app.store.getById('posts', record.id))
        .sort((a, b) => a.id() - b.id())
        .slice(0, 20);
    }

    this.stream = new PostStream({discussion, includedPosts});
  }

  view() {
    return (
      <div className="DiscussionPage">
        <div class="container">
          <div className="DiscussionPage-discussion">
            <div className="DiscussionPage-stream">
              {this.stream.render()}
            </div>
          </div>
        </div>
      </div>
    );
  }
}

{'fraction_non_alphanumeric': 0.14267352185089974, 'fraction_numerical': 0.002570694087403599, 'mean_word_length': 2.500749625187406, 'pattern_counts': {'":': 0, '<': 19, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3735745', 'n_tokens_mistral': 680, 'n_tokens_neox': 633, 'n_words': 143}