fix: Address review comments

This commit is contained in:
gsxdsm
2026-02-18 19:52:25 -08:00
parent 4ba0026aa1
commit 4ee160fae4
16 changed files with 184 additions and 35 deletions

View File

@@ -528,6 +528,12 @@ export function GitDiffPanel({
const handleStageFile = useCallback(
async (filePath: string) => {
if (!worktreePath && !projectPath) return;
if (enableStaging && useWorktrees && !worktreePath) {
toast.error('Failed to stage file', {
description: 'worktreePath required when useWorktrees is enabled',
});
return;
}
setStagingInProgress((prev) => new Set(prev).add(filePath));
try {
const api = getElectronAPI();
@@ -574,13 +580,19 @@ export function GitDiffPanel({
});
}
},
[worktreePath, projectPath, useWorktrees, loadDiffs]
[worktreePath, projectPath, useWorktrees, enableStaging, loadDiffs]
);
// Unstage a single file
const handleUnstageFile = useCallback(
async (filePath: string) => {
if (!worktreePath && !projectPath) return;
if (enableStaging && useWorktrees && !worktreePath) {
toast.error('Failed to unstage file', {
description: 'worktreePath required when useWorktrees is enabled',
});
return;
}
setStagingInProgress((prev) => new Set(prev).add(filePath));
try {
const api = getElectronAPI();
@@ -627,7 +639,7 @@ export function GitDiffPanel({
});
}
},
[worktreePath, projectPath, useWorktrees, loadDiffs]
[worktreePath, projectPath, useWorktrees, enableStaging, loadDiffs]
);
const handleStageAll = useCallback(async () => {

View File

@@ -226,6 +226,13 @@ export function CommitWorktreeDialog({
setSelectedFiles(new Set(fileList.map((f) => f.path)));
}
}
} else {
const errorMsg = result.error ?? 'Failed to load diffs';
console.warn('Failed to load diffs for commit dialog:', errorMsg);
if (!cancelled) {
setError(errorMsg);
toast.error(errorMsg);
}
}
}
} catch (err) {
@@ -480,7 +487,7 @@ export function CommitWorktreeDialog({
>
{getStatusLabel(file.status)}
</span>
{isStaged && !isUntracked && (
{isStaged && !isUnstaged && !isUntracked && (
<span className="text-[10px] px-1 py-0.5 rounded border font-medium flex-shrink-0 bg-green-500/15 text-green-400 border-green-500/30">
Staged
</span>

View File

@@ -214,6 +214,8 @@ export function DiscardWorktreeChangesDialog({
} else {
if (!cancelled) setError(result.error || 'Failed to fetch diffs');
}
} else {
if (!cancelled) setError('Diff API unavailable');
}
} catch (err) {
if (cancelled) return;