summaryrefslogtreecommitdiff
path: root/source/features/pr-commit-lines-changed.tsx
diff options
context:
space:
mode:
authorGravatar yakov116 <16872793+yakov116@users.noreply.github.com> 2020-05-27 13:19:59 -0400
committerGravatar GitHub <noreply@github.com> 2020-05-27 19:19:59 +0200
commitd45d63bb95c44fc0c9f0894ff038ca1dd5479ae1 (patch)
tree5fdfce03a7b0173849fbd29622a3f86417292f8a /source/features/pr-commit-lines-changed.tsx
parentef3cee995f8ba8da5337d8220f8ceed80d43febf (diff)
downloadrefined-github-d45d63bb95c44fc0c9f0894ff038ca1dd5479ae1.tar.gz
refined-github-d45d63bb95c44fc0c9f0894ff038ca1dd5479ae1.tar.zst
refined-github-d45d63bb95c44fc0c9f0894ff038ca1dd5479ae1.zip
Faster `pr-commit-lines-changed` (#3145)
Diffstat (limited to 'source/features/pr-commit-lines-changed.tsx')
-rw-r--r--source/features/pr-commit-lines-changed.tsx6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/features/pr-commit-lines-changed.tsx b/source/features/pr-commit-lines-changed.tsx
index 327bafe4..03193ef0 100644
--- a/source/features/pr-commit-lines-changed.tsx
+++ b/source/features/pr-commit-lines-changed.tsx
@@ -1,6 +1,5 @@
import React from 'dom-chef';
import cache from 'webext-storage-cache';
-import select from 'select-dom';
import elementReady from 'element-ready';
import * as pageDetect from 'github-url-detection';
@@ -27,10 +26,11 @@ const getCommitChanges = cache.function(async (commit: string): Promise<[number,
});
async function init(): Promise<void> {
- const commitSha = (await elementReady('.sha.user-select-contain'))!.textContent!;
+ const commitSha = location.pathname.split('/').pop()!;
const [additions, deletions] = await getCommitChanges(commitSha);
const tooltip = pluralize(additions + deletions, '1 line changed', '$$ lines changed');
- select('.diffstat')!.replaceWith(
+ const diffstat = await elementReady('.diffstat');
+ diffstat!.replaceWith(
<span className="ml-2 diffstat tooltipped tooltipped-s" aria-label={tooltip}>
<span className="text-green">+{additions}</span>{' '}
<span className="text-red">−{deletions}</span>{' '}