Fix chart reload bug #47

Merged
wagesj45 merged 1 commit from codex/fix-per-domain-charts-loading-bug into main 2025-07-19 16:42:18 -05:00

View file

@ -171,6 +171,15 @@
});
}
function destroyCharts(container) {
container.querySelectorAll('canvas').forEach(c => {
const chart = Chart.getChart(c);
if (chart) {
chart.destroy();
}
});
}
function loadReports() {
let path;
let container;
@ -183,6 +192,7 @@
} else {
container = containers.domain;
if (!currentDomain) {
destroyCharts(container);
container.innerHTML = '<p>Select a domain</p>';
return;
}
@ -192,6 +202,7 @@
fetch(path + '/reports.json')
.then(r => r.json())
.then(reports => {
destroyCharts(container);
container.innerHTML = '';
reports.forEach(rep => {
fetch(path + '/' + rep.html)