PR title/description is lost if we attempt to create a PR without being logged into GitHub (vibe-kanban) (#950)

This commit is contained in:
Britannio Jarrett
2025-10-17 14:31:41 +01:00
committed by GitHub
parent 1090255bd7
commit 362e3e23b4

View File

@@ -86,23 +86,40 @@ const CreatePrDialog = NiceModal.create(() => {
setPrTitle(''); setPrTitle('');
setPrBody(''); setPrBody('');
setPrBaseBranch(''); setPrBaseBranch('');
setCreatingPR(false);
modal.hide(); modal.hide();
} else { } else {
setCreatingPR(false);
if (result.error) { if (result.error) {
modal.hide(); modal.hide();
switch (result.error) { switch (result.error) {
case GitHubServiceError.TOKEN_INVALID: case GitHubServiceError.TOKEN_INVALID: {
NiceModal.show('github-login'); const authSuccess = await NiceModal.show('github-login');
break; if (authSuccess) {
case GitHubServiceError.INSUFFICIENT_PERMISSIONS: modal.show();
NiceModal.show('provide-pat'); await handleConfirmCreatePR();
break; }
case GitHubServiceError.REPO_NOT_FOUND_OR_NO_ACCESS: return;
NiceModal.show('provide-pat', { }
case GitHubServiceError.INSUFFICIENT_PERMISSIONS: {
const patProvided = await NiceModal.show('provide-pat');
if (patProvided) {
modal.show();
await handleConfirmCreatePR();
}
return;
}
case GitHubServiceError.REPO_NOT_FOUND_OR_NO_ACCESS: {
const patProvided = await NiceModal.show('provide-pat', {
errorMessage: errorMessage:
'Your token does not have access to this repository, or the repository does not exist. Please check the repository URL and/or provide a Personal Access Token with access.', 'Your token does not have access to this repository, or the repository does not exist. Please check the repository URL and/or provide a Personal Access Token with access.',
}); });
break; if (patProvided) {
modal.show();
await handleConfirmCreatePR();
}
return;
}
} }
} else if (result.message) { } else if (result.message) {
setError(result.message); setError(result.message);
@@ -110,7 +127,6 @@ const CreatePrDialog = NiceModal.create(() => {
setError('Failed to create GitHub PR'); setError('Failed to create GitHub PR');
} }
} }
setCreatingPR(false);
}, [data, prBaseBranch, prBody, prTitle, modal]); }, [data, prBaseBranch, prBody, prTitle, modal]);
const handleCancelCreatePR = useCallback(() => { const handleCancelCreatePR = useCallback(() => {