mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-12 01:35:45 +08:00
fix(git-panel): handle promise rejection in branch creation and return success status
This commit is contained in:
@@ -24,16 +24,22 @@ export default function NewBranchModal({
|
|||||||
}
|
}
|
||||||
}, [isOpen]);
|
}, [isOpen]);
|
||||||
|
|
||||||
const handleCreateBranch = async () => {
|
const handleCreateBranch = async (): Promise<boolean> => {
|
||||||
const branchName = newBranchName.trim();
|
const branchName = newBranchName.trim();
|
||||||
if (!branchName) {
|
if (!branchName) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const success = await onCreateBranch(branchName);
|
try {
|
||||||
if (success) {
|
const success = await onCreateBranch(branchName);
|
||||||
setNewBranchName('');
|
if (success) {
|
||||||
onClose();
|
setNewBranchName('');
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to create branch:', error);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user