<commit_before>import { connect } from 'react-redux';
import ProductList from './component';
import { addToList, removeFromList } from '../../redux/actions/user';


const capitalize = string => `${string[0].toUpperCase().concat(string.slice(1))}`;

const mapState = (state) => {
  const { translations } = state;
  const products = state.products.map(p => ({
    ...p,
    name: capitalize(translations[p.name]),
  }));

  return {
    products,
    userProducts: state.user.list.items.map(item => item.id),
    workingItem: state.ui.workingItem,
  };
};

const mapDispatch = dispatch => ({
  onAdd: productId => dispatch(addToList(productId)),
  onRemove: productId => dispatch(removeFromList(productId)),
});

export default connect(mapState, mapDispatch)(ProductList);<commit_msg>Fixed crash when missing translation<commit_after>import { connect } from 'react-redux';
import ProductList from './component';
import { addToList, removeFromList } from '../../redux/actions/user';


const capitalize = string => `${string[0].toUpperCase().concat(string.slice(1))}`;

const mapState = (state) => {
  const { translations } = state;
  const products = state.products.map(p => ({
    ...p,
    name: translations[p.name] ? capitalize(translations[p.name]) : p.name,
  }));

  return {
    products,
    userProducts: state.user.list.items.map(item => item.id),
    workingItem: state.ui.workingItem,
  };
};

const mapDispatch = dispatch => ({
  onAdd: productId => dispatch(addToList(productId)),
  onRemove: productId => dispatch(removeFromList(productId)),
});

export default connect(mapState, mapDispatch)(ProductList);
{'fraction_non_alphanumeric': 0.16656384947563233, 'fraction_numerical': 0.0024676125848241827, 'mean_word_length': 4.535836177474403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '2001433', 'n_tokens_mistral': 498, 'n_tokens_neox': 496, 'n_words': 103}