<commit_before>import { combineReducers } from 'redux';

function byId(state = {}, action) {
  switch (action.type) {
    case 'ADD_RECIPE_SUCCESS':
    case 'UPDATE_RECIPE_SUCCESS':
      return Object.assign(
        {},
        state,
        { [action.id]: action.response });
    case 'REMOVE_RECIPE_SUCCESS':
      const newState = Object.assign({}, state);
      delete newState[action.id];
      return newState;
    case 'FETCH_RECIPES_SUCCESS':
      return action.response;
    default:
      return state;
  }
}

function allIds(state = [], action) {
  switch (action.type) {
    case 'ADD_RECIPE_SUCCESS':
      return [...state, action.id];
    case 'REMOVE_RECIPE_SUCCESS':
      return state.filter(id => id !== action.id);
    case 'FETCH_RECIPES_SUCCESS':
      return Object.keys(action.response);
    default:
      return state;
  }
}

export function getMyRecipes(state) {<commit_msg>Fixed bug when there are no recipes<commit_after>import { combineReducers } from 'redux';

function byId(state = {}, action) {
  switch (action.type) {
    case 'ADD_RECIPE_SUCCESS':
    case 'UPDATE_RECIPE_SUCCESS':
      return Object.assign(
        {},
        state,
        { [action.id]: action.response });
    case 'REMOVE_RECIPE_SUCCESS':
      const newState = Object.assign({}, state);
      delete newState[action.id];
      return newState;
    case 'FETCH_RECIPES_SUCCESS':
      return action.response;
    default:
      return state;
  }
}

function allIds(state = [], action) {
  switch (action.type) {
    case 'ADD_RECIPE_SUCCESS':
      return [...state, action.id];
    case 'REMOVE_RECIPE_SUCCESS':
      return state.filter(id => id !== action.id);
    case 'FETCH_RECIPES_SUCCESS':
      return action.response ? Object.keys(action.response) : state;
    default:
      return state;
  }
}

export function getMyRecipes(state) {
{'fraction_non_alphanumeric': 0.12526881720430108, 'fraction_numerical': 0.0, 'mean_word_length': 2.9764957264957266, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2815097', 'n_tokens_mistral': 598, 'n_tokens_neox': 581, 'n_words': 130}