mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-30 06:12:03 +00:00
fix: Address PR review comments
- Fix window.Electron to window.isElectron in http-api-client.ts - Use void operator instead of async/await for onClick handlers in git-diff-panel.tsx - Fix critical bug: correct parameter order in useStartAutoMode (maxConcurrency was passed as branchName) - Add error handling for getApiKeys() result in use-cli-status.ts - Add authClaude guard in claude-cli-status.tsx for consistency with deauthClaude - Add optional chaining on api object in cursor-cli-status.tsx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -479,12 +479,7 @@ export function GitDiffPanel({
|
||||
<div className="flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground">
|
||||
<AlertCircle className="w-5 h-5 text-amber-500" />
|
||||
<span className="text-sm">{error}</span>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={async () => await loadDiffs()}
|
||||
className="mt-2"
|
||||
>
|
||||
<Button variant="ghost" size="sm" onClick={() => void loadDiffs()} className="mt-2">
|
||||
<RefreshCw className="w-4 h-4 mr-2" />
|
||||
Retry
|
||||
</Button>
|
||||
@@ -558,7 +553,7 @@ export function GitDiffPanel({
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={async () => await loadDiffs()}
|
||||
onClick={() => void loadDiffs()}
|
||||
className="text-xs h-7"
|
||||
>
|
||||
<RefreshCw className="w-3 h-3 mr-1" />
|
||||
|
||||
@@ -89,13 +89,17 @@ export function ClaudeCliStatus({ status, authStatus, isChecking, onRefresh }: C
|
||||
setIsAuthenticating(true);
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
if (!api.setup) {
|
||||
// Check if authClaude method exists on the API
|
||||
const authClaude = (api.setup as Record<string, unknown> | undefined)?.authClaude as
|
||||
| (() => Promise<{ success: boolean; error?: string }>)
|
||||
| undefined;
|
||||
if (!authClaude) {
|
||||
toast.error('Authentication Failed', {
|
||||
description: 'Setup API is not available',
|
||||
description: 'Claude authentication is not available',
|
||||
});
|
||||
return;
|
||||
}
|
||||
const result = await api.setup.authClaude();
|
||||
const result = await authClaude();
|
||||
|
||||
if (result.success) {
|
||||
toast.success('Signed In', {
|
||||
|
||||
@@ -210,7 +210,7 @@ export function CursorCliStatus({ status, isChecking, onRefresh }: CursorCliStat
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
// Check if authCursor method exists on the API
|
||||
const authCursor = (api.setup as Record<string, unknown> | undefined)?.authCursor as
|
||||
const authCursor = (api?.setup as Record<string, unknown> | undefined)?.authCursor as
|
||||
| (() => Promise<{ success: boolean; error?: string }>)
|
||||
| undefined;
|
||||
if (!authCursor) {
|
||||
@@ -245,7 +245,7 @@ export function CursorCliStatus({ status, isChecking, onRefresh }: CursorCliStat
|
||||
try {
|
||||
const api = getElectronAPI();
|
||||
// Check if deauthCursor method exists on the API
|
||||
const deauthCursor = (api.setup as Record<string, unknown> | undefined)?.deauthCursor as
|
||||
const deauthCursor = (api?.setup as Record<string, unknown> | undefined)?.deauthCursor as
|
||||
| (() => Promise<{ success: boolean; error?: string }>)
|
||||
| undefined;
|
||||
if (!deauthCursor) {
|
||||
|
||||
@@ -348,7 +348,7 @@ export function useStartAutoMode(projectPath: string) {
|
||||
mutationFn: async (maxConcurrency?: number) => {
|
||||
const api = getElectronAPI();
|
||||
if (!api.autoMode) throw new Error('AutoMode API not available');
|
||||
const result = await api.autoMode.start(projectPath, String(maxConcurrency ?? ''));
|
||||
const result = await api.autoMode.start(projectPath, undefined, maxConcurrency);
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Failed to start auto mode');
|
||||
}
|
||||
|
||||
@@ -69,6 +69,9 @@ export function useApiKeysStatus() {
|
||||
throw new Error('Setup API not available');
|
||||
}
|
||||
const result = await api.setup.getApiKeys();
|
||||
if (!result.success) {
|
||||
throw new Error('Failed to fetch API keys');
|
||||
}
|
||||
return result;
|
||||
},
|
||||
staleTime: STALE_TIMES.CLI_STATUS,
|
||||
|
||||
@@ -161,7 +161,7 @@ const getServerUrl = (): string => {
|
||||
|
||||
// In web mode (not Electron), use relative URL to leverage Vite proxy
|
||||
// This avoids CORS issues since requests appear same-origin
|
||||
if (!window.Electron) {
|
||||
if (!window.isElectron) {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user