Skip to content

Commit d0f7539

Browse files
Copilotmax-ostapenkotunetheweb
authored
Fix: Prevent duplicate percentage values when switching between mobile and desktop in Tech Report (#1140)
* Initial plan * Fix: Remove existing monthchange element before appending new one in updateAppSummary Co-authored-by: max-ostapenko <1611259+max-ostapenko@users.noreply.github.com> * Better implementation * Pin super linter --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: max-ostapenko <1611259+max-ostapenko@users.noreply.github.com> Co-authored-by: Barry Pollard <barrypollard@google.com>
1 parent 2dc9dc5 commit d0f7539

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/test-website.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
- name: Use more complete checks for generated HTML linting
3636
run: cp -f .github/linters/.htmlhintrc_morechecks .github/linters/.htmlhintrc
3737
- name: Lint Generated HTML
38-
uses: super-linter/super-linter/slim@v8
38+
uses: super-linter/super-linter/slim@v8.1.0
3939
env:
4040
DEFAULT_BRANCH: main
4141
FILTER_REGEX_INCLUDE: static/html/.*

src/js/techreport/timeseries.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,16 @@ class Timeseries {
249249
const latestMoM = latestClient?.momPerc;
250250
const latestMoMStr = latestClient?.momString;
251251
const styling = UIUtils.getChangeStatus(latestMoM, changeMeaning);
252-
const monthChange = document.createElement('span');
252+
253+
/* Add month change element if not already present */
254+
let monthChange = card.querySelector('.monthchange');
255+
if(!monthChange) {
256+
monthChange = document.createElement('span');
257+
card.appendChild(monthChange);
258+
}
259+
253260
monthChange.textContent = latestMoMStr;
254261
monthChange.className = `monthchange ${styling?.color} ${styling?.direction}`;
255-
card.appendChild(monthChange);
256262
}
257263
}
258264
});

0 commit comments

Comments
 (0)