Skip to content

Commit acc2d3c

Browse files
committed
Refactor logic for displaying self compare checkbox
1 parent 915e095 commit acc2d3c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,20 @@ const filter = ref(loadFilterFromUrl(urlParams, defaultCompileFilter));
217217
218218
// Should we use the backend as the source of before/after data?
219219
const selfCompareBackend = computed(() => {
220+
return canCompareBackends.value && filter.value.selfCompareBackend;
221+
});
222+
const canCompareBackends = computed(() => {
220223
const hasMultipleBackends =
221224
new Set(props.data.compile_comparisons.map((c) => c.backend)).size > 1;
222-
return (
223-
comparesIdenticalCommits.value &&
224-
filter.value.selfCompareBackend &&
225-
hasMultipleBackends
226-
);
225+
// Are we currently comparing the same commit in the before/after toolchains?
226+
const comparesSameCommit = props.data.a.commit === props.data.b.commit;
227+
return hasMultipleBackends && comparesSameCommit;
227228
});
228229
229230
function exportData() {
230231
exportToMarkdown(comparisons.value, filter.value.showRawData);
231232
}
232233
233-
// Are we currently comparing the same commit in the before/after toolchains?
234-
const comparesIdenticalCommits = computed(() => {
235-
return props.data.a.commit === props.data.b.commit;
236-
});
237234
const benchmarkMap = createCompileBenchmarkMap(props.data);
238235
239236
const compileComparisons = computed(() => {
@@ -265,7 +262,7 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
265262
:metrics="benchmarkInfo.compile_metrics"
266263
/>
267264
<div
268-
v-if="comparesIdenticalCommits"
265+
v-if="canCompareBackends"
269266
:title="`Compare codegen backends for commit '${props.data.a.commit}'`"
270267
>
271268
Compare codegen backends for this commit:

0 commit comments

Comments
 (0)