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:
parent
ee34f3b70c
commit
a71bf07dbf
@ -327,7 +327,10 @@ document.addEventListener("alpine:init", () => {
|
|||||||
try {
|
try {
|
||||||
const res = await fetch(`/apps/${this.appId}/status`);
|
const res = await fetch(`/apps/${this.appId}/status`);
|
||||||
const data = await res.json();
|
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
|
// Detect new deployment
|
||||||
if (
|
if (
|
||||||
@ -347,13 +350,13 @@ document.addEventListener("alpine:init", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.currentDeploymentId = data.latestDeploymentID;
|
this.currentDeploymentId = data.latestDeploymentID;
|
||||||
if (deploying) {
|
|
||||||
this.isDeploying = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reload page when deployment finishes
|
// Update deploying state based on latest deployment status
|
||||||
if (!deploying && this.isDeploying) {
|
if (deploying && !this.isDeploying) {
|
||||||
|
this.isDeploying = true;
|
||||||
|
} else if (!deploying && this.isDeploying) {
|
||||||
|
// Deployment finished - reload to show final state
|
||||||
this.isDeploying = false;
|
this.isDeploying = false;
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user