<commit_before>/*

  Search store

*/

import { createReducer } from "../utilities"

const initial = {
  term: null,
  items: [],
  page: 0,
  pageSize: 10,
  loading: false,
  done: false,
  none: false
}

export default createReducer(initial, {

  ["SEARCH.SET_TERM"](state, action) {
    return {...state,
      term: action.term
    }
  },

  ["SEARCH.ADD"](state, action) {
    return {...state,
      items: [ ...state.items, ...action.items ]
    }
  },

  ["SEARCH.CLEAR"](state, action) {
    return {...state,
      items: [],
      page: 0,
      done: false,
      none: false,
      loading: false
    }
  },

  ["SEARCH.INCREMENT_PAGE"](state, action) {
    return {...state,
      page: state.page + 1
    }
  },

  ["SEARCH.TOGGLE_LOADING"](state, action) {
    return {...state,
      loading: !state.loading<commit_msg>no need to clear loading<commit_after>/*

  Search store

*/

import { createReducer } from "../utilities"

const initial = {
  term: null,
  items: [],
  page: 0,
  pageSize: 10,
  loading: false,
  done: false,
  none: false
}

export default createReducer(initial, {

  ["SEARCH.SET_TERM"](state, action) {
    return {...state,
      term: action.term
    }
  },

  ["SEARCH.ADD"](state, action) {
    return {...state,
      items: [ ...state.items, ...action.items ]
    }
  },

  ["SEARCH.CLEAR"](state, action) {
    return {...state,
      items: [],
      page: 0,
      done: false,
      none: false
    }
  },

  ["SEARCH.INCREMENT_PAGE"](state, action) {
    return {...state,
      page: state.page + 1
    }
  },

  ["SEARCH.TOGGLE_LOADING"](state, action) {
    return {...state,
      loading: !state.loading
{'fraction_non_alphanumeric': 0.17678893565844858, 'fraction_numerical': 0.006013229104028864, 'mean_word_length': 2.2436647173489277, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '490947', 'n_tokens_mistral': 621, 'n_tokens_neox': 594, 'n_words': 129}