diff --git a/src/components/Node.tsx b/src/components/Node.tsx index 46cd6c1..dbbed06 100644 --- a/src/components/Node.tsx +++ b/src/components/Node.tsx @@ -1,7 +1,6 @@ import * as React from 'react' import Icon from 'components/Icon' import cx from 'utils/cx' -import LoadingIndicator from 'components/LoadingIndicator' import { TreeNode } from 'utils/VisibleNodesGenerator' import { os, OperatingSystems } from 'utils/general' @@ -41,18 +40,7 @@ export default class Node extends React.PureComponent { render() { const { node, depth, expanded, focused, renderActions, style } = this.props - const { name, path, virtual } = node - if (virtual) { - // this is not a real node - // for now, all virtual nodes are indicators for pending state - return ( -
-
- -
-
- ) - } + const { name, path } = node return (
= dispatch => { } } -const delayExpandThreshold = 400 - const goTo: MethodCreator = dispatch => async currentPath => { await visibleNodesGenerator.search('') dispatch.set({ searchKey: '', searched: false }) @@ -319,26 +317,12 @@ const goTo: MethodCreator = dispatch => async dispatch.call(updateVisibleNodes) } -function shouldDelayExpand(node: TreeNode) { - return ( - visibleNodesGenerator.visibleNodes.expandedNodes.has(node) && - Array.isArray(node.contents) && - node.contents.length > delayExpandThreshold - ) -} - const setExpand: MethodCreator = dispatch => ( node, expand = false, ) => { visibleNodesGenerator.setExpand(node, expand) - const applyChanges = () => dispatch.call(focusNode, node, false) - if (shouldDelayExpand(node)) { - dispatch.call(mountExpandingIndicator, node) - tasksAfterRender.push(() => setTimeout(applyChanges, 0)) - } else { - applyChanges() - } + dispatch.call(focusNode, node, false) } const toggleNodeExpansion: MethodCreator = dispatch => ( @@ -346,16 +330,8 @@ const toggleNodeExpansion: MethodCreator { visibleNodesGenerator.toggleExpand(node) - const applyChanges = () => { dispatch.call(focusNode, node, skipScrollToNode) tasksAfterRender.push(DOMHelper.focusFileExplorer) - } - if (shouldDelayExpand(node)) { - dispatch.call(mountExpandingIndicator, node) - tasksAfterRender.push(() => setTimeout(applyChanges, 0)) - } else { - applyChanges() - } } const focusNode: MethodCreator = dispatch => ( @@ -387,28 +363,6 @@ const onNodeClick: MethodCreator = dispatch = } } -const mountExpandingIndicator: MethodCreator< - Props, - ConnectorState, - [TreeNode] -> = dispatch => node => - dispatch.get(({ visibleNodes }) => { - if (!visibleNodes) return - const dummyVisibleNodes = { - ...visibleNodes, - nodes: visibleNodes.nodes.slice(), - } - dummyVisibleNodes.nodes.splice(dummyVisibleNodes.nodes.indexOf(node) + 1, 0, { - virtual: true, - name: 'Loading', - path: '-', - type: 'virtual', - }) - dispatch.set({ - visibleNodes: dummyVisibleNodes, - }) - }) - const updateVisibleNodes: MethodCreator = dispatch => () => { const { visibleNodes } = visibleNodesGenerator dispatch.set({ visibleNodes }) @@ -429,5 +383,4 @@ export default { focusNode, onNodeClick, updateVisibleNodes, - mountExpandingIndicator, } diff --git a/src/utils/visibleNodesGenerator.ts b/src/utils/visibleNodesGenerator.ts index 219d9c9..164bbf7 100644 --- a/src/utils/visibleNodesGenerator.ts +++ b/src/utils/visibleNodesGenerator.ts @@ -27,8 +27,7 @@ export type TreeNode = { path: string url?: string sha?: string - virtual?: boolean - type: 'tree' | 'blob' | 'commit' | 'virtual' + type: 'tree' | 'blob' | 'commit' accessDenied?: boolean }