<commit_before>import * as React from 'react'
import * as Container from '../../util/container'
import * as Types from '../../constants/types/fs'
import * as Constants from '../../constants/fs'
import * as FsGen from '../../actions/fs-gen'
import * as RPCTypes from '../../constants/types/rpc-gen'
import uuidv1 from 'uuid/v1'

const isPathItem = (path: Types.Path) => Types.getPathLevel(path) > 2 || Constants.hasSpecialFileElement(path)
const noop = () => {}

const useDispatchWhenConnected = () => {
  const kbfsDaemonConnected =
    Container.useSelector(state => state.fs.kbfsDaemonStatus.rpcStatus) ===
    Types.KbfsDaemonRpcStatus.Connected
  const dispatch = Container.useDispatch()
  return kbfsDaemonConnected ? dispatch : noop
}

const useDispatchWhenConnectedAndOnline = () => {
  const kbfsDaemonStatus = Container.useSelector(state => state.fs.kbfsDaemonStatus)
  const dispatch = Container.useDispatch()
  return kbfsDaemonStatus.rpcStatus === Types.KbfsDaemonRpcStatus.Connected &&
    kbfsDaemonStatus.onlineStatus === Types.KbfsDaemonOnlineStatus.Online
    ? dispatch
    : noop
}

const useFsPathSubscriptionEffect = (path: Types.Path, topic: RPCTypes.PathSubscriptionTopic) => {
  const dispatch = useDispatchWhenConnected()
  React.useEffect(() => {<commit_msg>fix fs tab on mobile (#18795)<commit_after>import * as React from 'react'
import * as Container from '../../util/container'
import * as Types from '../../constants/types/fs'
import * as Constants from '../../constants/fs'
import * as FsGen from '../../actions/fs-gen'
import * as RPCTypes from '../../constants/types/rpc-gen'
import uuidv1 from 'uuid/v1'
import flags from '../../util/feature-flags'

const isPathItem = (path: Types.Path) => Types.getPathLevel(path) > 2 || Constants.hasSpecialFileElement(path)
const noop = () => {}

const useDispatchWhenConnected = () => {
  const kbfsDaemonConnected =
    Container.useSelector(state => state.fs.kbfsDaemonStatus.rpcStatus) ===
    Types.KbfsDaemonRpcStatus.Connected
  const dispatch = Container.useDispatch()
  return kbfsDaemonConnected ? dispatch : noop
}

const useDispatchWhenConnectedAndOnline = flags.kbfsOfflineMode
  ? () => {
      const kbfsDaemonStatus = Container.useSelector(state => state.fs.kbfsDaemonStatus)
      const dispatch = Container.useDispatch()
      return kbfsDaemonStatus.rpcStatus === Types.KbfsDaemonRpcStatus.Connected &&
        kbfsDaemonStatus.onlineStatus === Types.KbfsDaemonOnlineStatus.Online
        ? dispatch
        : noop
    }
  : useDispatchWhenConnected

const useFsPathSubscriptionEffect = (path: Types.Path, topic: RPCTypes.PathSubscriptionTopic) => {
  const dispatch = useDispatchWhenConnected()
  React.useEffect(() => {
{'fraction_non_alphanumeric': 0.13053097345132744, 'fraction_numerical': 0.004056047197640118, 'mean_word_length': 4.288499025341131, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '3190196', 'n_tokens_mistral': 838, 'n_tokens_neox': 847, 'n_words': 177}