diff options
author | Gusted <williamzijl7@hotmail.com> | 2021-11-19 02:28:27 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-19 10:28:27 +0800 |
commit | 96ec656cf152a3663476bd26a410a13b993e6bac (patch) | |
tree | 9f32f9e436963fb4ece7f908ab472b420a873fb5 /web_src/js/features | |
parent | a85e75b2b19b1defa90364e8131b373489025ee6 (diff) | |
download | gitea-96ec656cf152a3663476bd26a410a13b993e6bac.tar.gz gitea-96ec656cf152a3663476bd26a410a13b993e6bac.zip |
perf: sent `data-path` once for each file (#17657)
- Don't sent it with each line, instead send it at the top-element for each file.
- Related:
https://github.com/go-gitea/gitea/pull/17618#issuecomment-968192761
2.5K Additions:
No-Patch:
Unified: 2.14 MB (2.14 MB size)
Split: 2.59 MB (2.59 MB size)
Patch:
Unified: 2.10 MB (2.10 MB size) (-1.8%)
Split: 2.55 MB (2.55 MB size) (-1.5%)
Diffstat (limited to 'web_src/js/features')
-rw-r--r-- | web_src/js/features/repo-diff.js | 4 | ||||
-rw-r--r-- | web_src/js/features/repo-issue.js | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js index 76355615c6..9606e3baad 100644 --- a/web_src/js/features/repo-diff.js +++ b/web_src/js/features/repo-diff.js @@ -29,9 +29,9 @@ export function initRepoDiffConversationForm() { form.closest('.conversation-holder').replaceWith(newConversationHolder); if (form.closest('tr').data('line-type') === 'same') { - $(`a.add-code-comment[data-path="${path}"][data-idx="${idx}"]`).addClass('invisible'); + $(`[data-path="${path}"] a.add-code-comment[data-idx="${idx}"]`).addClass('invisible'); } else { - $(`a.add-code-comment[data-path="${path}"][data-side="${side}"][data-idx="${idx}"]`).addClass('invisible'); + $(`[data-path="${path}"] a.add-code-comment[data-side="${side}"][data-idx="${idx}"]`).addClass('invisible'); } newConversationHolder.find('.dropdown').dropdown(); initCompReactionSelector(newConversationHolder); diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index b69ba25719..3022a01d41 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -167,9 +167,9 @@ export function initRepoIssueCommentDelete() { const idx = $conversationHolder.data('idx'); const lineType = $conversationHolder.closest('tr').data('line-type'); if (lineType === 'same') { - $(`a.add-code-comment[data-path="${path}"][data-idx="${idx}"]`).removeClass('invisible'); + $(`[data-path="${path}"] a.add-code-comment[data-idx="${idx}"]`).removeClass('invisible'); } else { - $(`a.add-code-comment[data-path="${path}"][data-side="${side}"][data-idx="${idx}"]`).removeClass('invisible'); + $(`[data-path="${path}"] a.add-code-comment[data-side="${side}"][data-idx="${idx}"]`).removeClass('invisible'); } $conversationHolder.remove(); } @@ -487,7 +487,7 @@ export function initRepoPullRequestReview() { const isSplit = $(this).closest('.code-diff').hasClass('code-diff-split'); const side = $(this).data('side'); const idx = $(this).data('idx'); - const path = $(this).data('path'); + const path = $(this).closest('[data-path]').data('path'); const tr = $(this).closest('tr'); const lineType = tr.data('line-type'); |