This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-5
lines changed
site/frontend/src/pages/compare Expand file tree Collapse file tree 3 files changed +31
-5
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,17 @@ function storeFilterToUrl(
161
161
function updateFilter(newFilter : CompileBenchmarkFilter ) {
162
162
storeFilterToUrl (newFilter , defaultCompileFilter , getUrlParams ());
163
163
filter .value = newFilter ;
164
+ refreshQuickLinks ();
165
+ }
166
+
167
+ /**
168
+ * When the filter changes, the URL is updated.
169
+ * After that happens, we want to re-render the quick links component, because
170
+ * it contains links that are "relative" to the current URL. Changing this
171
+ * key ref will cause it to be re-rendered.
172
+ */
173
+ function refreshQuickLinks() {
174
+ quickLinksKey .value += 1 ;
164
175
}
165
176
166
177
function exportData() {
@@ -169,6 +180,7 @@ function exportData() {
169
180
170
181
const urlParams = getUrlParams ();
171
182
183
+ const quickLinksKey = ref (0 );
172
184
const filter = ref (loadFilterFromUrl (urlParams , defaultCompileFilter ));
173
185
174
186
const benchmarkMap = createCompileBenchmarkMap (props .data );
@@ -187,6 +199,7 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
187
199
188
200
<template >
189
201
<MetricSelector
202
+ :key =" quickLinksKey"
190
203
:quick-links =" importantCompileMetrics"
191
204
:selected-metric =" selector.stat"
192
205
:metrics =" benchmarkInfo.compile_metrics"
Original file line number Diff line number Diff line change @@ -12,16 +12,15 @@ const props = defineProps<{
12
12
metrics: string [];
13
13
}>();
14
14
15
- function navigateToMetric (metric : string ) {
15
+ function createUrlForMetric (metric : string ): URL {
16
16
const params = {stat: metric };
17
- const url = createUrlWithAppendedParams (params );
18
- navigateToUrlParams (url .searchParams );
17
+ return createUrlWithAppendedParams (params );
19
18
}
20
19
21
20
function changeMetric(e : Event ) {
22
21
const target = e .target as HTMLSelectElement ;
23
22
const metric = target .value ;
24
- navigateToMetric ( metric );
23
+ navigateToUrlParams ( createUrlForMetric ( metric ). searchParams );
25
24
}
26
25
</script >
27
26
@@ -33,7 +32,7 @@ function changeMetric(e: Event) {
33
32
:class =" {active: props.selectedMetric === metric.metric}"
34
33
:title =" metric.description"
35
34
>
36
- <a href =" # " @click.prevent = " () => navigateToMetric( metric.metric)" >{{
35
+ <a : href =" createUrlForMetric( metric.metric).toString( )" >{{
37
36
metric.label
38
37
}}</a >
39
38
</div >
Original file line number Diff line number Diff line change @@ -73,9 +73,22 @@ function storeFilterToUrl(
73
73
function updateFilter(newFilter : RuntimeBenchmarkFilter ) {
74
74
storeFilterToUrl (newFilter , defaultRuntimeFilter , getUrlParams ());
75
75
filter .value = newFilter ;
76
+ refreshQuickLinks ();
77
+ }
78
+
79
+ /**
80
+ * When the filter changes, the URL is updated.
81
+ * After that happens, we want to re-render the quick links component, because
82
+ * it contains links that are "relative" to the current URL. Changing this
83
+ * key ref will cause it to be re-rendered.
84
+ */
85
+ function refreshQuickLinks() {
86
+ quickLinksKey .value += 1 ;
76
87
}
77
88
78
89
const urlParams = getUrlParams ();
90
+
91
+ const quickLinksKey = ref (0 );
79
92
const filter = ref (loadFilterFromUrl (urlParams , defaultRuntimeFilter ));
80
93
81
94
const allComparisons = computed (() =>
@@ -92,6 +105,7 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
92
105
93
106
<template >
94
107
<MetricSelector
108
+ :key =" quickLinksKey"
95
109
:quick-links =" importantRuntimeMetrics"
96
110
:selected-metric =" selector.stat"
97
111
:metrics =" benchmarkInfo.runtime_metrics"
You can’t perform that action at this time.
0 commit comments