summaryrefslogtreecommitdiff
path: root/source/features/default-branch-button.tsx
diff options
context:
space:
mode:
authorGravatar yakov116 <16872793+yakov116@users.noreply.github.com> 2020-06-03 09:41:38 -0400
committerGravatar GitHub <noreply@github.com> 2020-06-03 15:41:38 +0200
commitb393e2e2465a91ccbddf6ff60def616020712306 (patch)
treed528df90eb5da0558563c766712e81bfa800cd04 /source/features/default-branch-button.tsx
parente8eb6aca517b7e2d5fd2e81aaa64696cca0f08dd (diff)
downloadrefined-github-b393e2e2465a91ccbddf6ff60def616020712306.tar.gz
refined-github-b393e2e2465a91ccbddf6ff60def616020712306.tar.zst
refined-github-b393e2e2465a91ccbddf6ff60def616020712306.zip
Fix URL parsing in history views (#3153)
Co-Authored-By: Fregante <opensource@bfred.it>
Diffstat (limited to 'source/features/default-branch-button.tsx')
-rw-r--r--source/features/default-branch-button.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/features/default-branch-button.tsx b/source/features/default-branch-button.tsx
index 647a3da8..c8685e11 100644
--- a/source/features/default-branch-button.tsx
+++ b/source/features/default-branch-button.tsx
@@ -10,6 +10,12 @@ import getDefaultBranch from '../github-helpers/get-default-branch';
import {getCurrentBranch} from '../github-helpers';
async function init(): Promise<false | void> {
+ const branchSelector = await elementReady('#branch-select-menu');
+ // The branch selector is missing from History pages of files and folders (it only appears on the root)
+ if (!branchSelector) {
+ return false;
+ }
+
const defaultBranch = await getDefaultBranch();
const currentBranch = getCurrentBranch();
@@ -19,11 +25,6 @@ async function init(): Promise<false | void> {
}
const url = new GitHubURL(location.href);
- // The branch selector will be on `isRepoCommitList()` **unless** you're in a folder/file
- if (pageDetect.isRepoCommitList() && url.filePath.length > 0) {
- return false;
- }
-
if (pageDetect.isRepoRoot()) {
// The default branch of the root directory is just /user/repo/
url.route = '';
@@ -32,7 +33,6 @@ async function init(): Promise<false | void> {
url.branch = defaultBranch;
}
- const branchSelector = (await elementReady('#branch-select-menu'))!;
const defaultLink = (
<a
className="btn btn-sm tooltipped tooltipped-ne"