<commit_before>import * as types from "constants/action_types";
import lbryuri from "lbryuri";

const reducers = {};
const defaultState = {};

reducers[types.RESOLVE_URI_COMPLETED] = function(state, action) {
  const { uri, certificate, claim } = action.data;

  const byUri = Object.assign({}, state.claimsByUri);
  const byId = Object.assign({}, state.byId);

  if (claim) {
    byId[claim.claim_id] = claim;
    byUri[uri] = claim.claim_id;
  } else {
    byUri[uri] = null;
  }

  return Object.assign({}, state, {
    byId,
    claimsByUri: byUri
  });
}

reducers[types.RESOLVE_URI_CANCELED] = function(state, action) {
  const uri = action.data.uri;
  const newClaims = Object.assign({}, state.claimsByUri);
  delete newClaims[uri];
  return Object.assign({}, state, {
    claimsByUri: newClaims,
  });
};

reducers[types.FETCH_CLAIM_LIST_MINE_STARTED] = function(state, action) {
  return Object.assign({}, state, {
    isClaimListMinePending: true,
  });
};

reducers[types.FETCH_CLAIM_LIST_MINE_COMPLETED] = function(state, action) {
  const {
    claims,
  } = action.data;
  const myClaims = new Set(state.myClaims);<commit_msg>Make channel pages work again<commit_after>import * as types from "constants/action_types";
import lbryuri from "lbryuri";

const reducers = {};
const defaultState = {};

reducers[types.RESOLVE_URI_COMPLETED] = function(state, action) {
  const { uri, certificate, claim } = action.data;

  const byUri = Object.assign({}, state.claimsByUri);
  const byId = Object.assign({}, state.byId);

  if (claim) {
    byId[claim.claim_id] = claim;
    byUri[uri] = claim.claim_id;
  } else if (claim === undefined && certificate !== undefined) {
    byId[certificate.claim_id] = certificate;
    byUri[uri] = certificate.claim_id;
  } else {
    byUri[uri] = null;
  }

  return Object.assign({}, state, {
    byId,
    claimsByUri: byUri
  });
}

reducers[types.RESOLVE_URI_CANCELED] = function(state, action) {
  const uri = action.data.uri;
  const newClaims = Object.assign({}, state.claimsByUri);
  delete newClaims[uri];
  return Object.assign({}, state, {
    claimsByUri: newClaims,
  });
};

reducers[types.FETCH_CLAIM_LIST_MINE_STARTED] = function(state, action) {
  return Object.assign({}, state, {
    isClaimListMinePending: true,
  });
};

reducers[types.FETCH_CLAIM_LIST_MINE_COMPLETED] = function(state, action) {
  const {
    claims,
  } = action.data;
  const myClaims = new Set(state.myClaims);
{'fraction_non_alphanumeric': 0.14309076042518398, 'fraction_numerical': 0.0, 'mean_word_length': 4.273706896551724, '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': '4859507', 'n_tokens_mistral': 887, 'n_tokens_neox': 866, 'n_words': 171}