Skip to content

Commit

Permalink
make show stats work when only one file changed (#32244) (#32268)
Browse files Browse the repository at this point in the history
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 <1012112796@qq.com>
  • Loading branch information
a1012112796 authored Oct 17, 2024
1 parent c1023b9 commit 2a99607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions web_src/js/features/repo-diff-filetree.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ export function initDiffFileTree() {

const fileTreeView = createApp(DiffFileTree);
fileTreeView.mount(el);
}

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

Expand Down
3 changes: 2 additions & 1 deletion web_src/js/features/repo-diff.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import $ from 'jquery';
import {initCompReactionSelector} from './comp/ReactionSelector.js';
import {initRepoIssueContentHistory} from './repo-issue-content.js';
import {initDiffFileTree} from './repo-diff-filetree.js';
import {initDiffFileTree, initDiffFileList} from './repo-diff-filetree.js';
import {initDiffCommitSelect} from './repo-diff-commitselect.js';
import {validateTextareaNonEmpty} from './comp/ComboMarkdownEditor.js';
import {initViewedCheckboxListenerFor, countAndUpdateViewedFiles, initExpandAndCollapseFilesButton} from './pull-view-file.js';
Expand Down Expand Up @@ -220,6 +220,7 @@ export function initRepoDiffView() {
initRepoDiffConversationForm();
if (!$('#diff-file-list').length) return;
initDiffFileTree();
initDiffFileList();
initDiffCommitSelect();
initRepoDiffShowMore();
initRepoDiffReviewButton();
Expand Down

0 comments on commit 2a99607

Please sign in to comment.