Fix deploy button strobing by using deployment status

Use latestDeploymentStatus instead of app status to determine if
a deployment is in progress. The deployment status is more reliable
during state transitions and prevents the button from flickering.
This commit is contained in:
Jeffrey Paul 2026-01-01 06:52:43 -08:00
parent ee34f3b70c
commit a71bf07dbf

View File

@ -327,7 +327,10 @@ document.addEventListener("alpine:init", () => {
try {
const res = await fetch(`/apps/${this.appId}/status`);
const data = await res.json();
const deploying = Alpine.store("utils").isDeploying(data.status);
// Use deployment status, not app status - it's more reliable during transitions
const deploying = Alpine.store("utils").isDeploying(
data.latestDeploymentStatus,
);
// Detect new deployment
if (
@ -347,13 +350,13 @@ document.addEventListener("alpine:init", () => {
}
this.currentDeploymentId = data.latestDeploymentID;
if (deploying) {
this.isDeploying = true;
}
}
// Reload page when deployment finishes
if (!deploying && this.isDeploying) {
// Update deploying state based on latest deployment status
if (deploying && !this.isDeploying) {
this.isDeploying = true;
} else if (!deploying && this.isDeploying) {
// Deployment finished - reload to show final state
this.isDeploying = false;
window.location.reload();
}