<commit_before>
import React, { Component, PropTypes } from 'react';
import { getItems } from '../../actions';
import PageItem from './PageItem';

export default class PageContext extends Component {

  constructor() {
    super();
    this.state = { pages: [] };
  }

  componentDidMount() {
    this._load(this.props);
  }

  componentWillReceiveProps(nextProps) {
    this._load(nextProps);
  }

  componentWillUnmount() {
    this._unmounted = true;
  }

  _load(props) {
    const { filter } = props;
    if (filter) {
      getItems('pages', {
        filter,
        select: 'name path',
      })
      .then((pages) => {
        if (!this._unmounted) {
          this.setState({ pages });
        }
      })
      .catch(error => console.error('!!! PageContext pages catch', error));
    }
  }

  render() {<commit_msg>Only include public pages in PageContext.<commit_after>
import React, { Component, PropTypes } from 'react';
import { getItems } from '../../actions';
import PageItem from './PageItem';

export default class PageContext extends Component {

  constructor() {
    super();
    this.state = { pages: [] };
  }

  componentDidMount() {
    this._load(this.props);
  }

  componentWillReceiveProps(nextProps) {
    this._load(nextProps);
  }

  componentWillUnmount() {
    this._unmounted = true;
  }

  _load(props) {
    const { filter } = props;
    if (filter) {
      getItems('pages', {
        filter: { public: true, ...filter },
        select: 'name path',
      })
      .then((pages) => {
        if (!this._unmounted) {
          this.setState({ pages });
        }
      })
      .catch(error => console.error('!!! PageContext pages catch', error));
    }
  }

  render() {
{'fraction_non_alphanumeric': 0.15604909409701928, 'fraction_numerical': 0.0, 'mean_word_length': 2.4585858585858587, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4099968', 'n_tokens_mistral': 525, 'n_tokens_neox': 512, 'n_words': 118}