mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-18 10:23:07 +00:00
fix: Address review comments
This commit is contained in:
@@ -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 () => {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user