<commit_before>import * as types from '../actions/actionTypes';
import initialState from './initialState';

export default function repoReducer(state = initialState.repos, action) {
  switch (action.type) {
    case types.REPOS_LOADED: {
      return action.repos.map(repo => {
        return {
          ...repo,
          branches: null
        };
      });
    }
    case types.BRANCHES_LOADED_FOR_REPO: {
      let newRepo = state.find(filterRepo => filterRepo.name === action.repo.name);
      newRepo.branches = Array.from(action.branches);

      return [
        ...state.filter(filterRepo => filterRepo.name !== action.repo.name),
        Object.assign({}, newRepo)
      ];
    }
    default: {
      return state;
    }<commit_msg>Modify repoReducer for 'BRANCHES_LOADED_FOR_REPO' to initialize 'commits' to null in branch objects<commit_after>import * as types from '../actions/actionTypes';
import initialState from './initialState';

export default function repoReducer(state = initialState.repos, action) {
  switch (action.type) {
    case types.REPOS_LOADED: {
      return action.repos.map(repo => {
        return {
          ...repo,
          branches: null
        };
      });
    }
    case types.BRANCHES_LOADED_FOR_REPO: {
      let newRepo = state.find(filterRepo => filterRepo.name === action.repo.name);
      newRepo.branches = Array.from(action.branches);

      newRepo.branches = newRepo.branches.map(branch => {
        let newBranchObj = {
          ...branch,
          commits: null
        };

        return newBranchObj;
      });

      return [
        ...state.filter(filterRepo => filterRepo.name !== action.repo.name),
        Object.assign({}, newRepo)
      ];
    }
    default: {
      return state;
    }
{'fraction_non_alphanumeric': 0.12713797035347776, 'fraction_numerical': 0.0, 'mean_word_length': 2.3365019011406845, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '2616595', 'n_tokens_mistral': 535, 'n_tokens_neox': 534, 'n_words': 106}