-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Use git diff-tree
for DiffFileTree
on diff pages
#33514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4e74e74
3580286
5619691
b1ba89d
7adbb76
adf5f3c
3995ef5
a4d3bf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,32 +57,6 @@ | |
<div>{{ctx.Locale.Tr "repo.pulls.showing_specified_commit_range" (ShortSha .BeforeCommitID) (ShortSha .AfterCommitID)}} - <a href="{{$.Issue.Link}}/files?style={{if $.IsSplitStyle}}split{{else}}unified{{end}}&whitespace={{$.WhitespaceBehavior}}&show-outdated={{$.ShowOutdatedComments}}">{{ctx.Locale.Tr "repo.pulls.show_all_commits"}}</a></div> | ||
</div> | ||
{{end}} | ||
<script id="diff-data-script" type="module"> | ||
const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},IsSubmodule:{{$file.IsSubmodule}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}},IsViewed:{{$file.IsViewed}}},{{end}}]; | ||
const diffData = { | ||
isIncomplete: {{.Diff.IsIncomplete}}, | ||
tooManyFilesMessage: "{{ctx.Locale.Tr "repo.diff.too_many_files"}}", | ||
binaryFileMessage: "{{ctx.Locale.Tr "repo.diff.bin"}}", | ||
showMoreMessage: "{{ctx.Locale.Tr "repo.diff.show_more"}}", | ||
statisticsMessage: "{{ctx.Locale.Tr "repo.diff.stats_desc_file"}}", | ||
linkLoadMore: "?skip-to={{.Diff.End}}&file-only=true", | ||
}; | ||
|
||
// for first time loading, the diffFileInfo is a plain object | ||
// after the Vue component is mounted, the diffFileInfo is a reactive object | ||
// keep in mind that this script block would be executed many times when loading more files, by "loadMoreFiles" | ||
let diffFileInfo = window.config.pageData.diffFileInfo || { | ||
files:[], | ||
fileTreeIsVisible: false, | ||
fileListIsVisible: false, | ||
isLoadingNewData: false, | ||
selectedItem: '', | ||
}; | ||
diffFileInfo = Object.assign(diffFileInfo, diffData); | ||
diffFileInfo.files.push(...diffDataFiles); | ||
window.config.pageData.diffFileInfo = diffFileInfo; | ||
</script> | ||
<div id="diff-file-list"></div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this removal, will it not flash wrong content on page load when diff tree is visible? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I may be misunderstanding and this was just some data modification that has no reason to be in templates. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it's not related to "content flash" (and this block was marked as "module", it only executes after DOM ready). Some old PRs used very tricky methods to make the Vue work, now it's the time to make code overall right. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we should remove all such template js, except those cases that serve the purpose of avoiding flash, but those are better migrated to web components. |
||
{{end}} | ||
<div id="diff-container"> | ||
{{if $showFileTree}} | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.