only instantiate confirmAlert if needed

This commit is contained in:
Eduard Heimbuch
2020-11-12 14:56:45 +01:00
parent 595d97b211
commit 358b2ed993

View File

@@ -49,7 +49,9 @@ const DeleteBranch: FC<Props> = ({ repository, branch }: Props) => {
return null;
}
const confirmAlert = (
let confirmAlert = null;
if (showConfirmAlert) {
confirmAlert = (
<ConfirmAlert
title={t("branch.delete.confirmAlert.title")}
message={t("branch.delete.confirmAlert.message", { branch: branch.name })}
@@ -67,6 +69,7 @@ const DeleteBranch: FC<Props> = ({ repository, branch }: Props) => {
close={() => setShowConfirmAlert(false)}
/>
);
}
return (
<>