fix(git-panel): handle promise rejection in branch creation and return success status

This commit is contained in:
Haileyesus
2026-02-23 10:37:28 +03:00
parent f1fd9b2f87
commit dad3ed6d86

View File

@@ -24,16 +24,22 @@ export default function NewBranchModal({
}
}, [isOpen]);
const handleCreateBranch = async () => {
const handleCreateBranch = async (): Promise<boolean> => {
const branchName = newBranchName.trim();
if (!branchName) {
return;
return false;
}
const success = await onCreateBranch(branchName);
if (success) {
setNewBranchName('');
onClose();
try {
const success = await onCreateBranch(branchName);
if (success) {
setNewBranchName('');
onClose();
}
return success;
} catch (error) {
console.error('Failed to create branch:', error);
return false;
}
};