<commit_before>import React, { Component } from 'react';
import throttle from 'lodash/throttle';
import { Post } from 'components';
import Infinite from 'react-infinite';
import { connect } from 'react-redux';
import { asyncConnect } from 'redux-async-connect';
import Helmet from 'react-helmet';
import reduce from 'lodash/reduce';
import { window } from 'utils/lib';
import {
  mapStateToProps,
  actions,
  propTypes
} from './HomeSelectors';
import {
  CENTER_STYLE
} from './Home.styles';
import {
  POST_CONTAINER,
  PICTURE_STYLE,
} from 'components/Post/Post.styles';
import VideoPost from 'components/VideoPost/VideoPost';

@asyncConnect([{
  promise: ({ store: { dispatch } }) => dispatch(actions.loadRemaining()),
}])
@connect(mapStateToProps, actions)
export default class Home extends Component {

  static propTypes = propTypes

  componentDidMount() {
    window.addEventListener('resize', this.throttledCalculateContainerWidth);
    this.calculateContainerWidth();
  }

  componentDidUpdate() {
    // this.calculateContainerWidth();
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.throttledCalculateContainerWidth);
  }

  getPostHeight = index => {
    const {
      posts,
      imageRatios,
      containerWidth
    } = this.props;
    const post = posts[index];
    let photoHeight = imageRatios[index] * containerWidth;
    if (post.type === 'photo' && post.photos.length === 2) {
      photoHeight = photoHeight / 2;
    }
    return photoHeight + (
      // Add 20 for summary
      post.summary ? 20 : 0
    ) + (
      // Add 20 for tags
      !!post.tags.length ? 20 : 0
    ) +
      // and all the padding/margin
      POST_CONTAINER.marginBottom +
      POST_CONTAINER.paddingBottom +
      PICTURE_STYLE.marginBottom;
  }

  calculateContainerWidth = () => this
    .props
    .setContainerWidth(
      this.container.getBoundingClientRect().width
    )

  throttledCalculateContainerWidth = () => throttle(this.calculateContainerWidth, 500)()
<commit_msg>fixed weird post not existing thing<commit_after>import React, { Component } from 'react';
import throttle from 'lodash/throttle';
import { Post } from 'components';
import Infinite from 'react-infinite';
import { connect } from 'react-redux';
import { asyncConnect } from 'redux-async-connect';
import Helmet from 'react-helmet';
import reduce from 'lodash/reduce';
import { window } from 'utils/lib';
import {
  mapStateToProps,
  actions,
  propTypes
} from './HomeSelectors';
import {
  CENTER_STYLE
} from './Home.styles';
import {
  POST_CONTAINER,
  PICTURE_STYLE,
} from 'components/Post/Post.styles';
import VideoPost from 'components/VideoPost/VideoPost';

@asyncConnect([{
  promise: ({ store: { dispatch } }) => dispatch(actions.loadRemaining()),
}])
@connect(mapStateToProps, actions)
export default class Home extends Component {

  static propTypes = propTypes

  componentDidMount() {
    window.addEventListener('resize', this.throttledCalculateContainerWidth);
    this.calculateContainerWidth();
  }

  componentDidUpdate() {
    // this.calculateContainerWidth();
  }

  componentWillUnmount() {
    window.removeEventListener('resize', this.throttledCalculateContainerWidth);
  }

  getPostHeight = index => {
    const {
      posts,
      imageRatios,
      containerWidth
    } = this.props;
    const post = posts[index];
    // wtf?
    if (!post) return 0;
    let photoHeight = imageRatios[index] * containerWidth;
    if (post.type === 'photo' && post.photos.length === 2) {
      photoHeight = photoHeight / 2;
    }
    return photoHeight + (
      // Add 20 for summary
      post.summary ? 20 : 0
    ) + (
      // Add 20 for tags
      !!post.tags.length ? 20 : 0
    ) +
      // and all the padding/margin
      POST_CONTAINER.marginBottom +
      POST_CONTAINER.paddingBottom +
      PICTURE_STYLE.marginBottom;
  }

  calculateContainerWidth = () => this
    .props
    .setContainerWidth(
      this.container.getBoundingClientRect().width
    )

  throttledCalculateContainerWidth = () => throttle(this.calculateContainerWidth, 500)()

{'fraction_non_alphanumeric': 0.12044954800879551, 'fraction_numerical': 0.007573906669924261, 'mean_word_length': 3.5187637969094925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4982598', 'n_tokens_mistral': 1292, 'n_tokens_neox': 1208, 'n_words': 278}