<commit_before>'use strict';

var React = require('react');
var classes = require('classnames');
var merge = require('lodash.merge');
var StyleMixin = require('../../lib/StyleMixin');
var css = require('./index.styl');

var DOM = React.DOM;
var PropTypes = React.PropTypes;

module.exports = React.createClass({
  displayName: 'UserImage',
  mixins: [StyleMixin],
  css: css,
  propTypes: {
    src: PropTypes.string
  },
  getDefaultProps: function() {
    return {
      style: {},
      src: 'http://www.gravatar.com/avatar/0?d=mm&s=300'
    };
  },
  render: function() {

    var props = merge({
      className: classes('user-image-component', this.props.className),
      style: merge({
        background: '#cdcdcd url(' + this.props.src + ')'
      })
    }, this.props);

    return DOM.div(props, this.props.children);<commit_msg>start all loading before the image hits the dom<commit_after>'use strict';

var React = require('react');
var classes = require('classnames');
var merge = require('lodash.merge');
var StyleMixin = require('../../lib/StyleMixin');
var css = require('./index.styl');

var DOM = React.DOM;
var PropTypes = React.PropTypes;

function preload(src){
  if (src) {
    new Image().src = src;
  }
}

module.exports = React.createClass({
  displayName: 'UserImage',
  mixins: [StyleMixin],
  css: css,
  propTypes: {
    src: PropTypes.string
  },
  getDefaultProps: function() {
    return {
      style: {},
      src: 'http://www.gravatar.com/avatar/0?d=mm&s=300'
    };
  },
  componentWillMount: function() {
    preload(this.props.src);
  },
  componentWillReceiveProps: function(props) {
    preload(props.src);
  },
  render: function() {
    var props = merge({
      className: classes('user-image-component', this.props.className),
      style: merge({
        background: '#cdcdcd url(' + this.props.src + ')'
      })
    }, this.props);

    return DOM.div(props, this.props.children);
{'fraction_non_alphanumeric': 0.17098445595854922, 'fraction_numerical': 0.004145077720207254, 'mean_word_length': 3.3295964125560538, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1182425', 'n_tokens_mistral': 633, 'n_tokens_neox': 626, 'n_words': 136}