Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions devops/scripts/benchmarks/html/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -63,7 +64,9 @@ const toggleConfigs = {
document.querySelectorAll('.benchmark-note').forEach(note => {
note.style.display = isEnabled ? 'block' : 'none';
});
updateURL();
if (!isInitializing) {
updateURL();
}
}
},
'show-unstable': {
Expand Down Expand Up @@ -97,7 +100,9 @@ const toggleConfigs = {
location.reload();
}
}
updateURL();
if (!isInitializing) {
updateURL();
}
}
}
,
Expand All @@ -111,7 +116,9 @@ const toggleConfigs = {
updateFlameGraphTooltip();
// Refresh download buttons to adapt to new mode
refreshDownloadButtons();
updateURL();
if (!isInitializing) {
updateURL();
}
}
}
};
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down