From de902b590ffef9be21fbc06bbc1f05bbf467dde6 Mon Sep 17 00:00:00 2001 From: Aaradhya-07 Date: Tue, 14 Jul 2026 20:09:21 +0530 Subject: [PATCH] fix: clear result fields on re-run to avoid stale values (#197) --- src/js/app.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/js/app.js b/src/js/app.js index 7dbb50c..834c4d0 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -113,6 +113,17 @@ const SpeedTest = { this.els.resultsSection.style.display = this.measurementComplete ? 'block' : 'none'; }, + /** + * Clear the displayed result fields so a re-run can't show stale + * values from a previous test if the current one fails partway. + */ + clearResults() { + this.els.s2cRate.textContent = ''; + this.els.c2sRate.textContent = ''; + this.els.latency.textContent = ''; + this.els.loss.textContent = ''; + }, + async startTest() { if (!this.privacyConsent || this.testRunning) { return; @@ -122,6 +133,7 @@ const SpeedTest = { this.testRunning = true; this.measurementComplete = false; this.measurementResult = {}; + this.clearResults(); this.updateUI(); // Scroll to measurement area on mobile