diff options
author | 2020-06-03 09:41:38 -0400 | |
---|---|---|
committer | 2020-06-03 15:41:38 +0200 | |
commit | b393e2e2465a91ccbddf6ff60def616020712306 (patch) | |
tree | d528df90eb5da0558563c766712e81bfa800cd04 /source/features/default-branch-button.tsx | |
parent | e8eb6aca517b7e2d5fd2e81aaa64696cca0f08dd (diff) | |
download | refined-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.tsx | 12 |
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" |