<commit_before>import React from 'react'
import { connect } from 'react-redux'
import {
  AnimatedTransitionGroup,
  AnimatedChild
} from 'animated-transition-group'

import UniversalComponent from './UniversalComponent'
import styles from '../css/Switcher'

const Switcher = ({ page, direction, isLoading }) =>
  <AnimatedTransitionGroup
    component='div'
    className={`${styles.switcher} ${direction}`}
    duration={500}
    prefix='fade'
  >
    <AnimatedChild key={debouncedKey(page, isLoading)}>
      <UniversalComponent page={page} isLoading={isLoading} />
    </AnimatedChild>
  </AnimatedTransitionGroup>

const debouncedKey = (page, isLoading) =>
  isLoading ? page : page + +new Date()

const mapState = ({ page, direction, videosByCategory }) => {
  const { category, categories } = videosByCategory
  const isLoading = page === 'List' && !categories[category]
  return { page, direction, isLoading }
}
<commit_msg>fix($debounce): refactor<commit_after>import React from 'react'
import { connect } from 'react-redux'
import {
  AnimatedTransitionGroup,
  AnimatedChild
} from 'animated-transition-group'

import UniversalComponent from './UniversalComponent'
import styles from '../css/Switcher'

const Switcher = ({ page, direction, isLoading }) =>
  <AnimatedTransitionGroup
    component='div'
    className={`${styles.switcher} ${direction}`}
    duration={500}
    prefix='fade'
  >
    <AnimatedChild key={debounce(page)}>
      <UniversalComponent page={page} isLoading={isLoading} />
    </AnimatedChild>
  </AnimatedTransitionGroup>

const debounce = page => page + +new Date()

const mapState = ({ page, direction, videosByCategory }) => {
  const { category, categories } = videosByCategory
  const isLoading = page === 'List' && !categories[category]
  return { page, direction, isLoading }
}

{'fraction_non_alphanumeric': 0.1350164654226125, 'fraction_numerical': 0.003293084522502744, 'mean_word_length': 4.768987341772152, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 19, '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': '4908317', 'n_tokens_mistral': 535, 'n_tokens_neox': 529, 'n_words': 131}