diff --git a/devops/scripts/benchmarks/html/scripts.js b/devops/scripts/benchmarks/html/scripts.js
index b3764aab40b09..50dd0160391e3 100644
--- a/devops/scripts/benchmarks/html/scripts.js
+++ b/devops/scripts/benchmarks/html/scripts.js
@@ -16,6 +16,7 @@ let chartObserver; // Intersection observer for lazy loading charts
let annotationsOptions = new Map(); // Global options map for annotations
let archivedDataLoaded = false;
let loadedBenchmarkRuns = []; // Loaded results from the js/json files
+let isInitializing = true; // Flag for a proper handling of URLs
// Global variables loaded from data.js/data.json:
// - benchmarkRuns: array of benchmark run data
// - benchmarkMetadata: metadata for benchmarks and groups
@@ -63,7 +64,9 @@ const toggleConfigs = {
document.querySelectorAll('.benchmark-note').forEach(note => {
note.style.display = isEnabled ? 'block' : 'none';
});
- updateURL();
+ if (!isInitializing) {
+ updateURL();
+ }
}
},
'show-unstable': {
@@ -97,7 +100,9 @@ const toggleConfigs = {
location.reload();
}
}
- updateURL();
+ if (!isInitializing) {
+ updateURL();
+ }
}
}
,
@@ -111,7 +116,9 @@ const toggleConfigs = {
updateFlameGraphTooltip();
// Refresh download buttons to adapt to new mode
refreshDownloadButtons();
- updateURL();
+ if (!isInitializing) {
+ updateURL();
+ }
}
}
};
@@ -1016,7 +1023,10 @@ function updateURL() {
url.searchParams.delete('regex');
}
- if (activeSuites.length > 0 && activeSuites.length != suiteNames.size) {
+ // Include suites parameter if not all suites are selected
+ // OR if the original URL had a suites parameter (preserve user's explicit selection)
+ const hadSuitesParam = getQueryParam('suites') !== null;
+ if (activeSuites.length > 0 && (activeSuites.length != suiteNames.size || hadSuitesParam)) {
url.searchParams.set('suites', activeSuites.join(','));
} else {
url.searchParams.delete('suites');
@@ -1085,7 +1095,10 @@ function filterCharts() {
container.classList.toggle('hidden', !shouldShow);
});
- updateURL();
+ // Don't update URL during initial page load to preserve URL parameters
+ if (!isInitializing) {
+ updateURL();
+ }
}
function getActiveSuites() {
@@ -1746,6 +1759,12 @@ function initializeCharts() {
// Draw initial charts
updateCharts();
+
+ // Mark initialization as complete - URL parameters have been applied
+ isInitializing = false;
+
+ // Update the URL to ensure it reflects the final state after initialization
+ updateURL();
}
// Make functions available globally for onclick handlers