Skip to content

Commit 268ec1f

Browse files
committed
fix(ui): scope deployment delete loading
1 parent 018e56a commit 268ec1f

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎apps/dokploy/components/dashboard/application/deployments/show-deployments.tsx‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export const ShowDeployments = ({
6363
const [activeLog, setActiveLog] = useState<
6464
RouterOutputs["deployment"]["all"][number] | null
6565
>(null);
66+
const [removingDeploymentId, setRemovingDeploymentId] = useState<
67+
string | null
68+
>(null);
6669
const { data: deployments, isPending: isLoadingDeployments } =
6770
api.deployment.allByType.useQuery(
6871
{
@@ -408,20 +411,26 @@ export const ShowDeployments = ({
408411
description="Are you sure you want to delete this deployment? This action cannot be undone."
409412
type="default"
410413
onClick={async () => {
414+
setRemovingDeploymentId(deployment.deploymentId);
411415
try {
412416
await removeDeployment({
413417
deploymentId: deployment.deploymentId,
414418
});
415419
toast.success("Deployment deleted successfully");
416420
} catch (error) {
417421
toast.error("Error deleting deployment");
422+
} finally {
423+
setRemovingDeploymentId(null);
418424
}
419425
}}
420426
>
421427
<Button
422428
variant="destructive"
423429
size="sm"
424-
isLoading={isRemovingDeployment}
430+
isLoading={
431+
isRemovingDeployment &&
432+
removingDeploymentId === deployment.deploymentId
433+
}
425434
>
426435
Delete
427436
<Trash2 className="size-4" />

0 commit comments

Comments
 (0)