Skip to content

Commit 2a99607

Browse files
authored
make show stats work when only one file changed (#32244) (#32268)
Backport #32244 fix #32226 in #27775 , it do some changes to only show diff file tree when more than one file changed. But looks it also break the `diff-file-list` logic, which looks not expected change. so try fix it. /cc @silverwind example view: ![image](https://github.com/user-attachments/assets/281e9c4f-a269-4d36-94eb-a132058aea87) Signed-off-by: a1012112796 <[email protected]>
1 parent c1023b9 commit 2a99607

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

web_src/js/features/repo-diff-filetree.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export function initDiffFileTree() {
88

99
const fileTreeView = createApp(DiffFileTree);
1010
fileTreeView.mount(el);
11+
}
1112

13+
export function initDiffFileList() {
1214
const fileListElement = document.getElementById('diff-file-list');
1315
if (!fileListElement) return;
1416

web_src/js/features/repo-diff.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import $ from 'jquery';
22
import {initCompReactionSelector} from './comp/ReactionSelector.js';
33
import {initRepoIssueContentHistory} from './repo-issue-content.js';
4-
import {initDiffFileTree} from './repo-diff-filetree.js';
4+
import {initDiffFileTree, initDiffFileList} from './repo-diff-filetree.js';
55
import {initDiffCommitSelect} from './repo-diff-commitselect.js';
66
import {validateTextareaNonEmpty} from './comp/ComboMarkdownEditor.js';
77
import {initViewedCheckboxListenerFor, countAndUpdateViewedFiles, initExpandAndCollapseFilesButton} from './pull-view-file.js';
@@ -220,6 +220,7 @@ export function initRepoDiffView() {
220220
initRepoDiffConversationForm();
221221
if (!$('#diff-file-list').length) return;
222222
initDiffFileTree();
223+
initDiffFileList();
223224
initDiffCommitSelect();
224225
initRepoDiffShowMore();
225226
initRepoDiffReviewButton();

0 commit comments

Comments
 (0)