Skip to content

Commit b71ae80

Browse files
Merge pull request #60392 from ClickHouse/fix-duplicate-chart-rendering
Fix duplicate and dangling charts on the Dashboard
2 parents 814cd53 + f9c0089 commit b71ae80

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

programs/server/dashboard.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@
255255
font-weight: bold;
256256
user-select: none;
257257
cursor: pointer;
258-
padding-left: 0.5rem;
259-
padding-right: 0.5rem;
260258
background: var(--new-chart-background-color);
261259
color: var(--new-chart-text-color);
262260
float: right;
@@ -275,7 +273,6 @@
275273
width: 36%;
276274
}
277275

278-
279276
#global-error {
280277
align-self: center;
281278
width: 60%;
@@ -1273,8 +1270,11 @@
12731270
}
12741271

12751272
let firstLoad = true;
1276-
1273+
let is_drawing = false; // Prevent race condition leading to duplicate/dangling charts.
12771274
async function drawAll() {
1275+
if (is_drawing) return;
1276+
is_drawing = true;
1277+
12781278
let params = getParamsForURL();
12791279
const chartsArray = document.getElementsByClassName('chart');
12801280

@@ -1301,12 +1301,12 @@
13011301
document.getElementById('edit').style.display = 'inline-block';
13021302
document.getElementById('search-span').style.display = '';
13031303
hideError();
1304-
}
1305-
else {
1306-
const charts = document.getElementById('charts')
1307-
charts.style.height = '0px';
1304+
} else {
1305+
document.getElementById('charts').style.height = '0px';
13081306
}
13091307
});
1308+
1309+
is_drawing = false;
13101310
}
13111311

13121312
function resize() {

0 commit comments

Comments
 (0)