@@ -12,10 +12,6 @@ let timeseriesData, barChartsData, allRunNames;
1212// DOM Elements
1313let runSelect , selectedRunsDiv , suiteFiltersContainer ;
1414
15- // Add this at the top of the file with the other variable declarations
16- let showNotes = true ;
17- let showUnstable = false ;
18-
1915// Run selector functions
2016function updateSelectedRuns ( forceUpdate = true ) {
2117 selectedRunsDiv . innerHTML = '' ;
@@ -215,7 +211,7 @@ function createChartContainer(data, canvasId, type) {
215211 const unstableWarning = document . createElement ( 'div' ) ;
216212 unstableWarning . className = 'benchmark-unstable' ;
217213 unstableWarning . textContent = metadata . unstable ;
218- unstableWarning . style . display = showUnstable ? 'block' : 'none' ;
214+ unstableWarning . style . display = isUnstableEnabled ( ) ? 'block' : 'none' ;
219215 container . appendChild ( unstableWarning ) ;
220216 }
221217
@@ -224,7 +220,7 @@ function createChartContainer(data, canvasId, type) {
224220 const noteElement = document . createElement ( 'div' ) ;
225221 noteElement . className = 'benchmark-note' ;
226222 noteElement . textContent = metadata . notes ;
227- noteElement . style . display = showNotes ? 'block' : 'none' ;
223+ noteElement . style . display = isNotesEnabled ( ) ? 'block' : 'none' ;
228224 container . appendChild ( noteElement ) ;
229225 }
230226
@@ -390,8 +386,8 @@ function updateURL() {
390386 }
391387
392388 // Add toggle states to URL
393- url . searchParams . set ( 'notes' , showNotes ) ;
394- url . searchParams . set ( 'unstable' , showUnstable ) ;
389+ url . searchParams . set ( 'notes' , isNotesEnabled ( ) ) ;
390+ url . searchParams . set ( 'unstable' , isUnstableEnabled ( ) ) ;
395391
396392 history . replaceState ( null , '' , url ) ;
397393}
@@ -409,16 +405,11 @@ function filterCharts() {
409405 // Hide unstable benchmarks if showUnstable is false
410406 const shouldShow = regex . test ( label ) &&
411407 activeSuites . includes ( suite ) &&
412- ( showUnstable || ! isUnstable ) ;
408+ ( isUnstableEnabled ( ) || ! isUnstable ) ;
413409
414410 container . style . display = shouldShow ? '' : 'none' ;
415411 } ) ;
416412
417- // Update notes visibility
418- document . querySelectorAll ( '.benchmark-note' ) . forEach ( note => {
419- note . style . display = showNotes ? 'block' : 'none' ;
420- } ) ;
421-
422413 updateURL ( ) ;
423414}
424415
@@ -464,7 +455,7 @@ function processTimeseriesData(benchmarkRuns) {
464455function processBarChartsData ( benchmarkRuns ) {
465456 const groupedResults = { } ;
466457
467- benchmarkRuns . forEach ( run => {
458+ benchmarkRuns . reverse ( ) . forEach ( run => {
468459 run . results . forEach ( result => {
469460 if ( ! result . explicit_group ) return ;
470461
@@ -547,24 +538,31 @@ function setupSuiteFilters() {
547538 } ) ;
548539}
549540
541+ function isNotesEnabled ( ) {
542+ const notesToggle = document . getElementById ( 'show-notes' ) ;
543+ return notesToggle . checked ;
544+ }
545+
546+ function isUnstableEnabled ( ) {
547+ const unstableToggle = document . getElementById ( 'show-unstable' ) ;
548+ return unstableToggle . checked ;
549+ }
550+
550551function setupToggles ( ) {
551552 const notesToggle = document . getElementById ( 'show-notes' ) ;
552553 const unstableToggle = document . getElementById ( 'show-unstable' ) ;
553554
554555 notesToggle . addEventListener ( 'change' , function ( ) {
555- showNotes = this . checked ;
556556 // Update all note elements visibility
557557 document . querySelectorAll ( '.benchmark-note' ) . forEach ( note => {
558- note . style . display = showNotes ? 'block' : 'none' ;
558+ note . style . display = isNotesEnabled ( ) ? 'block' : 'none' ;
559559 } ) ;
560- filterCharts ( ) ;
561560 } ) ;
562561
563562 unstableToggle . addEventListener ( 'change' , function ( ) {
564- showUnstable = this . checked ;
565563 // Update all unstable warning elements visibility
566564 document . querySelectorAll ( '.benchmark-unstable' ) . forEach ( warning => {
567- warning . style . display = showUnstable ? 'block' : 'none' ;
565+ warning . style . display = isUnstableEnabled ( ) ? 'block' : 'none' ;
568566 } ) ;
569567 filterCharts ( ) ;
570568 } ) ;
@@ -574,12 +572,12 @@ function setupToggles() {
574572 const unstableParam = getQueryParam ( 'unstable' ) ;
575573
576574 if ( notesParam !== null ) {
577- showNotes = notesParam === 'true' ;
575+ let showNotes = notesParam === 'true' ;
578576 notesToggle . checked = showNotes ;
579577 }
580578
581579 if ( unstableParam !== null ) {
582- showUnstable = unstableParam === 'true' ;
580+ let showUnstable = unstableParam === 'true' ;
583581 unstableToggle . checked = showUnstable ;
584582 }
585583}
0 commit comments