fix: mismatch between table field columns and results with duplicate fields, fixes #848

This commit is contained in:
Fabio Di Stasio 2024-09-20 18:08:11 +02:00
parent 37d44c95ee
commit da8cc39157
1 changed files with 6 additions and 1 deletions

View File

@ -38,7 +38,7 @@
<div class="thead">
<div class="tr">
<div
v-for="(field, index) in fields"
v-for="(field, index) in filteredFields"
:key="index"
class="th c-hand"
:title="`${field.type} ${fieldLength(field) ? `(${fieldLength(field)})` : ''}`"
@ -383,6 +383,11 @@ const sortedResults = computed(() => {
const resultsWithRows = computed(() => props.results.filter(result => result.rows.length));
const fields = computed(() => resultsWithRows.value.length ? resultsWithRows.value[resultsetIndex.value].fields : []);
const filteredFields = computed(() => fields.value.reduce((acc, cur) => {
if (acc.findIndex(f => JSON.stringify(f) === JSON.stringify(cur)))
acc.push(cur);
return acc;
}, [] as TableField[]));
const keyUsage = computed(() => resultsWithRows.value.length ? resultsWithRows.value[resultsetIndex.value].keys : []);
const fieldsObj = computed(() => {