Skip to content

Commit 19778e5

Browse files
committed
fix flickering issue with consecutive error poll check
1 parent 8357120 commit 19778e5

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

templates/apps/deployment_progress.html

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
4545
<div class="small text-muted mb-4" id="progress-next-step">
4646
We will open the app details page automatically when everything is ready.
4747
</div>
48+
<div class="small text-warning d-none mb-4" id="progress-poll-warning">
49+
Could not load the latest deployment update. Retrying automatically.
50+
</div>
4851

4952
<div class="d-flex flex-wrap gap-2">
5053
<a href="{{ form_url }}" class="btn btn-outline-secondary">Back to form</a>
@@ -102,6 +105,7 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
102105
let progressPoller = null;
103106
let successRedirectTimer = null;
104107
let consecutiveSuccessPolls = 0;
108+
let consecutiveErrorPolls = 0;
105109
let stepRevealTimer = null;
106110
let latestServerData = {
107111
deployment: {
@@ -128,6 +132,13 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
128132
}
129133
}
130134

135+
function updatePollWarning(isVisible) {
136+
const warning = document.getElementById("progress-poll-warning");
137+
if (warning) {
138+
warning.classList.toggle("d-none", !isVisible);
139+
}
140+
}
141+
131142
function copyProgressData(data = {}) {
132143
return {
133144
deployment: {...(data.deployment || {})},
@@ -379,6 +390,12 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
379390
updateHeader(data.deployment, steps);
380391
}
381392

393+
function renderProgressShell(data) {
394+
const steps = data.steps || [];
395+
updateSummary(steps, data.deployment);
396+
updateHeader(data.deployment, steps);
397+
}
398+
382399
function areSameStep(left, right) {
383400
return JSON.stringify(left || null) === JSON.stringify(right || null);
384401
}
@@ -442,7 +459,7 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
442459
...displayedProgressData,
443460
deployment: {...latestServerData.deployment}
444461
};
445-
renderProgress(displayedProgressData);
462+
renderProgressShell(displayedProgressData);
446463
maybeRedirectToDetails(displayedProgressData);
447464
return;
448465
}
@@ -485,6 +502,8 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
485502
return response.json();
486503
})
487504
.then(data => {
505+
consecutiveErrorPolls = 0;
506+
updatePollWarning(false);
488507
const fresh = copyProgressData(data);
489508

490509
if (isProgressSuccessful(fresh)) {
@@ -509,10 +528,8 @@ <h1 class="h3 mb-2 deployment-progress-title" id="progress-title">We are prepari
509528
})
510529
.catch(error => {
511530
console.error("Error fetching deployment progress:", error);
512-
const inline = document.getElementById("progress-inline");
513-
if (inline) {
514-
inline.textContent = "Could not load the latest deployment update. Retrying automatically.";
515-
}
531+
consecutiveErrorPolls += 1;
532+
updatePollWarning(consecutiveErrorPolls >= 2);
516533
throw error;
517534
});
518535
}

0 commit comments

Comments
 (0)