summaryrefslogtreecommitdiff
path: root/source/features/default-branch-button.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'source/features/default-branch-button.tsx')
-rw-r--r--source/features/default-branch-button.tsx10
1 files changed, 4 insertions, 6 deletions
diff --git a/source/features/default-branch-button.tsx b/source/features/default-branch-button.tsx
index 0f2e400f..2c5b7fa4 100644
--- a/source/features/default-branch-button.tsx
+++ b/source/features/default-branch-button.tsx
@@ -7,16 +7,14 @@ import features from '../feature-manager.js';
import GitHubURL from '../github-helpers/github-url.js';
import {groupButtons} from '../github-helpers/group-buttons.js';
import getDefaultBranch from '../github-helpers/get-default-branch.js';
-import {getCurrentCommittish} from '../github-helpers/index.js';
import observe from '../helpers/selector-observer.js';
import {branchSelector} from '../github-helpers/selectors.js';
+import isDefaultBranch from '../github-helpers/is-default-branch.js';
async function add(branchSelector: HTMLElement): Promise<void> {
- const defaultBranch = await getDefaultBranch();
- const currentBranch = getCurrentCommittish();
-
// Don't show the button if we’re already on the default branch
- if (defaultBranch === currentBranch) {
+ // TODO: Move to `asLongAs` when it accepts async detections
+ if (await isDefaultBranch()) {
return;
}
@@ -26,7 +24,7 @@ async function add(branchSelector: HTMLElement): Promise<void> {
url.route = '';
url.branch = '';
} else {
- url.branch = defaultBranch;
+ url.branch = await getDefaultBranch();
}
const defaultLink = (