mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-06-04 11:45:38 +08:00
fix(git-panel): add error handling for branch switch and fetch operations
This commit is contained in:
@@ -89,9 +89,21 @@ export default function GitPanelHeader({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleSwitchBranch = async (branchName: string) => {
|
const handleSwitchBranch = async (branchName: string) => {
|
||||||
const success = await onSwitchBranch(branchName);
|
try {
|
||||||
if (success) {
|
const success = await onSwitchBranch(branchName);
|
||||||
setShowBranchDropdown(false);
|
if (success) {
|
||||||
|
setShowBranchDropdown(false);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[GitPanelHeader] Failed to switch branch:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleFetch = async () => {
|
||||||
|
try {
|
||||||
|
await onFetch();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[GitPanelHeader] Failed to fetch remote changes:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -214,7 +226,7 @@ export default function GitPanelHeader({
|
|||||||
|
|
||||||
{shouldShowFetchButton && (
|
{shouldShowFetchButton && (
|
||||||
<button
|
<button
|
||||||
onClick={() => void onFetch()}
|
onClick={() => void handleFetch()}
|
||||||
disabled={isFetching}
|
disabled={isFetching}
|
||||||
className="px-2.5 py-1 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-50 flex items-center gap-1 transition-colors"
|
className="px-2.5 py-1 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-50 flex items-center gap-1 transition-colors"
|
||||||
title={`Fetch from ${remoteName}`}
|
title={`Fetch from ${remoteName}`}
|
||||||
|
|||||||
Reference in New Issue
Block a user