<commit_before>import { ListsAction, ListsActionTypes } from './lists.actions';
import { List } from '../model/list';


export interface ListsState {
  myLists: List[];
  listsWithWriteAccess: List[],
  listDetails: List[];
  selectedId?: string; // which Lists record has been selected
  myListsConnected: boolean;
  listsWithWriteAccessConnected: boolean;
  communityListsConnected: boolean;
}

export const initialState: ListsState = {
  myLists: [],
  listsWithWriteAccess: [],
  listDetails: [],
  myListsConnected: false,
  listsWithWriteAccessConnected: false,
  communityListsConnected: false
};

export function listsReducer(
  state: ListsState = initialState,
  action: ListsAction
): ListsState {
  switch (action.type) {
    case ListsActionTypes.MyListsLoaded: {
      state = {
        ...state,
        myLists: [
          ...action.payload
        ],
        myListsConnected: true
      };
      break;
    }

    case ListsActionTypes.ListsWithWriteAccessLoaded: {
      state = {
        ...state,
        listsWithWriteAccess: [
          ...action.payload
        ],
        listsWithWriteAccessConnected: true
      };
      break;
    }

    case ListsActionTypes.UpdateList: {
      state = {<commit_msg>fix: fixed list duplicates if you are the owner of a FC-wide shared list<commit_after>import { ListsAction, ListsActionTypes } from './lists.actions';
import { List } from '../model/list';


export interface ListsState {
  myLists: List[];
  listsWithWriteAccess: List[],
  listDetails: List[];
  selectedId?: string; // which Lists record has been selected
  myListsConnected: boolean;
  listsWithWriteAccessConnected: boolean;
  communityListsConnected: boolean;
}

export const initialState: ListsState = {
  myLists: [],
  listsWithWriteAccess: [],
  listDetails: [],
  myListsConnected: false,
  listsWithWriteAccessConnected: false,
  communityListsConnected: false
};

export function listsReducer(
  state: ListsState = initialState,
  action: ListsAction
): ListsState {
  switch (action.type) {
    case ListsActionTypes.MyListsLoaded: {
      state = {
        ...state,
        myLists: [
          ...action.payload
        ],
        myListsConnected: true
      };
      break;
    }

    case ListsActionTypes.ListsWithWriteAccessLoaded: {
      state = {
        ...state,
        listsWithWriteAccess: [
          ...action.payload.filter(list => state.myLists.find(l => l.$key === list.$key) === undefined)
        ],
        listsWithWriteAccessConnected: true
      };
      break;
    }

    case ListsActionTypes.UpdateList: {
      state = {
{'fraction_non_alphanumeric': 0.10828516377649326, 'fraction_numerical': 0.0, 'mean_word_length': 2.8746268656716416, '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': '1560263', 'n_tokens_mistral': 773, 'n_tokens_neox': 749, 'n_words': 171}