<commit_before>/*
 *
 * MassiveMap reducer
 *
 */

import { fromJS } from 'immutable';
import {
  LOAD_HINTS,
  LOAD_HINTS_ERROR,
  LOAD_HINTS_SUCCESS,
  LOAD_STATUS,
  LOAD_STATUS_SUCCESS,
  LOAD_STATUS_ERROR,
  LOAD_CARS_SUCCESS,
  LOAD_CARS_ERROR,
  TOGGLE_HISTORY,
  LOAD_CARS, RIGHT_CLICK_EVENT, RIGHT_CLICK_EVENT_SUCCESS, CLEAR_LOCATION,
} from './constants';

const initialState = fromJS({
  loading: false,
  error: false,
  hints: false,
  loadingStatus: false,
  errorStatus: false,
  status: false,
  carsLoading: false,
  carsError: false,
  cars: false,
  history: false,
  loadRightClick: false,
  rightClickLatLng: false,
  rightClickLocation: false,
});

function massiveMapReducer(state = initialState, action) {
  switch (action.type) {
    case LOAD_HINTS:
      return state
        .set('hints', false)
        .set('loading', true)
        .set('error', false);
    case LOAD_HINTS_SUCCESS:
      return state
        .set('hints', action.hints)
        .set('loading', false)
        .set('error', false);
    case LOAD_HINTS_ERROR:
      return state
        .set('loading', false)
        .set('error', action.error);
    case LOAD_STATUS_ERROR:
      return state
        .set('errorStatus', action.error)
        .set('status', false)
        .set('loadingStatus', false);
    case RIGHT_CLICK_EVENT:
      return state
        .set('loadRightClick', true)
        .set('rightClickLatLng', action.latlng);<commit_msg>Reduced hints update flicker<commit_after>/*
 *
 * MassiveMap reducer
 *
 */

import { fromJS } from 'immutable';
import {
  LOAD_HINTS,
  LOAD_HINTS_ERROR,
  LOAD_HINTS_SUCCESS,
  LOAD_STATUS,
  LOAD_STATUS_SUCCESS,
  LOAD_STATUS_ERROR,
  LOAD_CARS_SUCCESS,
  LOAD_CARS_ERROR,
  TOGGLE_HISTORY,
  LOAD_CARS, RIGHT_CLICK_EVENT, RIGHT_CLICK_EVENT_SUCCESS, CLEAR_LOCATION,
} from './constants';

const initialState = fromJS({
  loading: false,
  error: false,
  hints: false,
  loadingStatus: false,
  errorStatus: false,
  status: false,
  carsLoading: false,
  carsError: false,
  cars: false,
  history: false,
  loadRightClick: false,
  rightClickLatLng: false,
  rightClickLocation: false,
});

function massiveMapReducer(state = initialState, action) {
  switch (action.type) {
    case LOAD_HINTS:
      return state
        .set('hints', false);
    case LOAD_HINTS_SUCCESS:
      return state
        .set('hints', action.hints)
        .set('loading', false)
        .set('error', false);
    case LOAD_HINTS_ERROR:
      return state
        .set('loading', false)
        .set('error', action.error);
    case LOAD_STATUS_ERROR:
      return state
        .set('errorStatus', action.error)
        .set('status', false)
        .set('loadingStatus', false);
    case RIGHT_CLICK_EVENT:
      return state
        .set('loadRightClick', true)
        .set('rightClickLatLng', action.latlng);
{'fraction_non_alphanumeric': 0.11392405063291139, 'fraction_numerical': 0.0, 'mean_word_length': 3.2085798816568047, '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': '2215117', 'n_tokens_mistral': 1001, 'n_tokens_neox': 969, 'n_words': 206}