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(
161161function updateFilter(newFilter : CompileBenchmarkFilter ) {
162162 storeFilterToUrl (newFilter , defaultCompileFilter , getUrlParams ());
163163 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 ;
164175}
165176
166177function exportData() {
@@ -169,6 +180,7 @@ function exportData() {
169180
170181const urlParams = getUrlParams ();
171182
183+ const quickLinksKey = ref (0 );
172184const filter = ref (loadFilterFromUrl (urlParams , defaultCompileFilter ));
173185
174186const benchmarkMap = createCompileBenchmarkMap (props .data );
@@ -187,6 +199,7 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
187199
188200<template >
189201 <MetricSelector
202+ :key =" quickLinksKey"
190203 :quick-links =" importantCompileMetrics"
191204 :selected-metric =" selector.stat"
192205 :metrics =" benchmarkInfo.compile_metrics"
Original file line number Diff line number Diff line change @@ -12,16 +12,15 @@ const props = defineProps<{
1212 metrics: string [];
1313}>();
1414
15- function navigateToMetric (metric : string ) {
15+ function createUrlForMetric (metric : string ): URL {
1616 const params = {stat: metric };
17- const url = createUrlWithAppendedParams (params );
18- navigateToUrlParams (url .searchParams );
17+ return createUrlWithAppendedParams (params );
1918}
2019
2120function changeMetric(e : Event ) {
2221 const target = e .target as HTMLSelectElement ;
2322 const metric = target .value ;
24- navigateToMetric ( metric );
23+ navigateToUrlParams ( createUrlForMetric ( metric ). searchParams );
2524}
2625 </script >
2726
@@ -33,7 +32,7 @@ function changeMetric(e: Event) {
3332 :class =" {active: props.selectedMetric === metric.metric}"
3433 :title =" metric.description"
3534 >
36- <a href =" # " @click.prevent = " () => navigateToMetric( metric.metric)" >{{
35+ <a : href =" createUrlForMetric( metric.metric).toString( )" >{{
3736 metric.label
3837 }}</a >
3938 </div >
Original file line number Diff line number Diff line change @@ -73,9 +73,22 @@ function storeFilterToUrl(
7373function updateFilter(newFilter : RuntimeBenchmarkFilter ) {
7474 storeFilterToUrl (newFilter , defaultRuntimeFilter , getUrlParams ());
7575 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 ;
7687}
7788
7889const urlParams = getUrlParams ();
90+
91+ const quickLinksKey = ref (0 );
7992const filter = ref (loadFilterFromUrl (urlParams , defaultRuntimeFilter ));
8093
8194const allComparisons = computed (() =>
@@ -92,6 +105,7 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
92105
93106<template >
94107 <MetricSelector
108+ :key =" quickLinksKey"
95109 :quick-links =" importantRuntimeMetrics"
96110 :selected-metric =" selector.stat"
97111 :metrics =" benchmarkInfo.runtime_metrics"
You can’t perform that action at this time.
0 commit comments