diff --git a/src/driver/core/FileExplorer.ts b/src/driver/core/FileExplorer.ts index 070355f..c2cbea1 100644 --- a/src/driver/core/FileExplorer.ts +++ b/src/driver/core/FileExplorer.ts @@ -61,17 +61,21 @@ export const setUpTree: BoundMethodCreator<[ }, }) visibleNodesGenerator.onUpdate(visibleNodes => dispatch.set({ visibleNodes })) - - dispatch.set({ state: 'done' }) - if (platform.shouldExpandAll?.()) { - visibleNodesGenerator.visibleNodes.nodes.forEach(node => - dispatch.call(toggleNodeExpansion, node, { recursive: true }), - ) + const unsubscribe = visibleNodesGenerator.onUpdate(visibleNodes => { + unsubscribe() + visibleNodes.nodes.forEach(node => + dispatch.call(toggleNodeExpansion, node, { recursive: true }), + ) + }) + dispatch.call(search, '') } else { const targetPath = platform.getCurrentPath(metaData.branchName) if (targetPath) dispatch.call(goTo, targetPath) + else dispatch.call(search, '') } + + dispatch.set({ state: 'done' }) } export const handleKeyDown: BoundMethodCreator<[React.KeyboardEvent]> = dispatch => event => { diff --git a/src/platforms/GitHub/index.ts b/src/platforms/GitHub/index.ts index 73aad0b..9667644 100644 --- a/src/platforms/GitHub/index.ts +++ b/src/platforms/GitHub/index.ts @@ -151,23 +151,10 @@ export const GitHub: Platform = { url: `https://${window.location.host}/${metaData.userName}/${ metaData.repoName }/pull/${pullId}/files${window.location.search}#${id || ''}`, - contents: undefined, sha: item.sha, } }) - const missingFolders = findMissingFolders(nodes) - nodes.push( - ...missingFolders.map( - folder => - ({ - name: folder.replace(/^.*\//, ''), - path: folder, - type: 'tree', - } as TreeNode), - ), - ) - const root = processTree(nodes) return { root } }