Skip to content

Commit 636db78

Browse files
authored
Merge pull request #1602 from Kobzol/compare-quick-links-url
Update quick links URL after filters change
2 parents 794f21a + bc96e98 commit 636db78

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

site/frontend/src/pages/compare/header/quick-links.vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<script setup lang="ts">
2-
import {
3-
createUrlWithAppendedParams,
4-
getUrlParams,
5-
} from "../../../utils/navigation";
2+
import {createUrlWithAppendedParams} from "../../../utils/navigation";
63
74
const props = defineProps<{stat: string}>();
85
@@ -19,8 +16,7 @@ function createMetric(
1916
}
2017
2118
function createUrlForMetric(stat: string): string {
22-
const params = getUrlParams();
23-
params["stat"] = stat;
19+
const params = {stat};
2420
return createUrlWithAppendedParams(params).toString();
2521
}
2622

site/frontend/src/pages/compare/page.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,20 @@ function updateSelection(params: SelectionParams) {
170170
);
171171
}
172172
173+
/**
174+
* When the filter changes, the URL is updated.
175+
* After that happens, we want to re-render the quick links component, because
176+
* it contains links that are "relative" to the current URL. Changing this
177+
* key ref will cause it to be re-rendered.
178+
*/
179+
function refreshQuickLinks() {
180+
quickLinksKey.value += 1;
181+
}
182+
173183
function updateFilter(newFilter: DataFilter) {
174-
filter.value = newFilter;
175184
storeFilterToUrl(newFilter, defaultFilter, getUrlParams());
185+
filter.value = newFilter;
186+
refreshQuickLinks();
176187
}
177188
178189
function exportData() {
@@ -213,6 +224,7 @@ const filteredSummary = computed(() => computeSummary(testCases.value));
213224
214225
const loading = ref(false);
215226
227+
const quickLinksKey = ref(0);
216228
const info = await loadBenchmarkInfo();
217229
const selector = loadSelectorFromUrl(urlParams);
218230
const filter = ref(loadFilterFromUrl(urlParams, defaultFilter));
@@ -235,7 +247,7 @@ loadCompareData(selector, loading);
235247
<p>Loading ...</p>
236248
</div>
237249
<div v-if="data !== null">
238-
<QuickLinks :stat="selector.stat" />
250+
<QuickLinks :stat="selector.stat" :key="quickLinksKey" />
239251
<Filters
240252
:defaultFilter="defaultFilter"
241253
:initialFilter="filter"

0 commit comments

Comments
 (0)