diff --git a/src/driver/core/FileExplorer.ts b/src/driver/core/FileExplorer.ts index 1325e1d..4248d6b 100644 --- a/src/driver/core/FileExplorer.ts +++ b/src/driver/core/FileExplorer.ts @@ -68,11 +68,18 @@ export const setUpTree: BoundMethodCreator<[ }) visibleNodesGenerator.init() - tasksAfterRender.push(DOMHelper.focusSearchInput) dispatch.set({ state: 'done' }) - const targetPath = platform.getCurrentPath(metaData.branchName) - if (targetPath) dispatch.call(goTo, targetPath) + + if (platform.shouldExpandAll?.()) { + visibleNodesGenerator.visibleNodes.nodes.forEach(node => + dispatch.call(toggleNodeExpansion, node, { skipScrollToNode: true, recursive: true }), + ) + dispatch.call(updateVisibleNodes) + } else { + const targetPath = platform.getCurrentPath(metaData.branchName) + if (targetPath) dispatch.call(goTo, targetPath) + } } export const execAfterRender: BoundMethodCreator = dispatch => () => { diff --git a/src/platforms/GitHub/index.ts b/src/platforms/GitHub/index.ts index a4e81e0..d0b325d 100644 --- a/src/platforms/GitHub/index.ts +++ b/src/platforms/GitHub/index.ts @@ -203,6 +203,9 @@ export const GitHub: Platform = { shouldShow() { return Boolean(DOMHelper.isInCodePage() || URLHelper.isInPullPage()) }, + shouldExpandAll() { + return Boolean(URLHelper.isInPullPage()) + }, getCurrentPath(branchName) { return URLHelper.getCurrentPath(branchName) }, diff --git a/src/platforms/platform.d.ts b/src/platforms/platform.d.ts index 1dfed0a..0dee955 100644 --- a/src/platforms/platform.d.ts +++ b/src/platforms/platform.d.ts @@ -7,6 +7,7 @@ type Platform = { ): Promise> getTreeData(metaData: MetaData, accessToken?: string): Promise shouldShow(): boolean + shouldExpandAll?(): boolean getCurrentPath(branchName: string): string[] | null setOAuth(code: string): Promise getOAuthLink(): string