summaryrefslogtreecommitdiff
path: root/source/libs
diff options
context:
space:
mode:
Diffstat (limited to 'source/libs')
-rw-r--r--source/libs/features.tsx5
-rw-r--r--source/libs/get-default-branch.ts10
2 files changed, 3 insertions, 12 deletions
diff --git a/source/libs/features.tsx b/source/libs/features.tsx
index a84c5b17..cc8f718f 100644
--- a/source/libs/features.tsx
+++ b/source/libs/features.tsx
@@ -64,10 +64,7 @@ onAjaxedPages(async () => {
await globalReady; // Match `add()`
await Promise.resolve(); // Kicks it to the next tick, after the other features have `run()`
- const ajaxContainer = select('#js-repo-pjax-container,#js-pjax-container');
- if (ajaxContainer) {
- ajaxContainer.append(<has-rgh/>);
- }
+ select('#js-repo-pjax-container, #js-pjax-container')?.append(<has-rgh/>);
});
let log: typeof console.log;
diff --git a/source/libs/get-default-branch.ts b/source/libs/get-default-branch.ts
index b056f0c6..11930d2a 100644
--- a/source/libs/get-default-branch.ts
+++ b/source/libs/get-default-branch.ts
@@ -16,14 +16,8 @@ function parseBranchFromDom(): string | undefined {
}
// We can find the name in the infobar, available in folder views
- const branchInfo = select('.branch-infobar');
- if (!branchInfo) {
- return;
- }
-
- // Parse the infobar
- const matches = branchInfoRegex.exec(branchInfo.textContent!.trim());
- return matches ? matches[1] : undefined;
+ const branchInfo = select('.branch-infobar')?.textContent?.trim();
+ return branchInfoRegex.exec(branchInfo!)?.[1];
}
async function fetchFromApi(): Promise<string> {