From e62324bb97c36bf3a71a262bcdc7f78c13f3aeee Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Mon, 23 Sep 2024 22:04:47 +0800 Subject: [PATCH] fix: update github branch switcher selectors --- src/platforms/GitHub/DOMHelper.ts | 7 ++++++- src/platforms/GitHub/index.ts | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/platforms/GitHub/DOMHelper.ts b/src/platforms/GitHub/DOMHelper.ts index d3db701d..7a0c7761 100644 --- a/src/platforms/GitHub/DOMHelper.ts +++ b/src/platforms/GitHub/DOMHelper.ts @@ -11,7 +11,12 @@ const selectors = { normal: { reactApp: `react-app[app-name="react-code-view"] [data-target="react-app.reactRoot"]`, codeTab: '#code-tab', - branchSwitcher: [`summary[title="Switch branches or tags"]`, `#branch-select-menu`].join(), + branchSwitcher: [ + `summary[title="Switch branches or tags"]`, + `#branch-select-menu`, + `#branch-picker-repos-header-ref-selector`, + `#branch-picker-repos-header-ref-selector-wide`, + ].join(), fileNavigation: `.file-navigation`, breadcrumbs: `[data-testid="breadcrumbs"]`, breadcrumbsFilename: `[data-testid="breadcrumbs-filename"]`, diff --git a/src/platforms/GitHub/index.ts b/src/platforms/GitHub/index.ts index 513511e2..83229adb 100644 --- a/src/platforms/GitHub/index.ts +++ b/src/platforms/GitHub/index.ts @@ -169,9 +169,9 @@ export const GitHub: Platform = { }, shouldExpandSideBar() { return Boolean( - (DOMHelper.isInCodePage() && !DOMHelper.isNativePRFileTreeShown()) || - URLHelper.isInCommitPage() || - (URLHelper.isInPullPage() && !DOMHelper.isNativePRFileTreeShown()), + (DOMHelper.isInCodePage() || URLHelper.isInCommitPage() || URLHelper.isInPullPage()) && + !DOMHelper.isNativeFileTreeShown() && + !DOMHelper.isNativePRFileTreeShown(), ) }, shouldExpandAll() {