mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-03-03 21:17:50 +00:00
fix(git-panel): improve commit expansion logic and fetch diff condition
This commit is contained in:
@@ -24,21 +24,24 @@ export default function HistoryView({
|
||||
|
||||
const toggleCommitExpanded = useCallback(
|
||||
(commitHash: string) => {
|
||||
const isExpanding = !expandedCommits.has(commitHash);
|
||||
|
||||
setExpandedCommits((previous) => {
|
||||
const next = new Set(previous);
|
||||
if (next.has(commitHash)) {
|
||||
next.delete(commitHash);
|
||||
} else {
|
||||
next.add(commitHash);
|
||||
// Load commit diff lazily only the first time a commit is expanded.
|
||||
if (!commitDiffs[commitHash]) {
|
||||
void onFetchCommitDiff(commitHash);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
});
|
||||
|
||||
// Load commit diff lazily only the first time a commit is expanded.
|
||||
if (isExpanding && !commitDiffs[commitHash]) {
|
||||
void onFetchCommitDiff(commitHash);
|
||||
}
|
||||
},
|
||||
[commitDiffs, onFetchCommitDiff],
|
||||
[commitDiffs, expandedCommits, onFetchCommitDiff, setExpandedCommits],
|
||||
);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user