Skip to content

Commit 5e0414b

Browse files
committed
ensure fields posted in AutoQueryGrid are unique
1 parent 08ecccb commit 5e0414b

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/components/AutoQueryGrid.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ import { computed, inject, nextTick, onMounted, ref, useSlots, getCurrentInstanc
181181
import { ApiResult, appendQueryString, combinePaths, delaySet, leftPart, mapGet, queryString, rightPart } from '@servicestack/client'
182182
import { Apis, createDto, getPrimaryKey, isComplexProp, typeProperties, useMetadata } from '@/use/metadata'
183183
import { a, grid } from './css'
184-
import { asOptions, asStrings, copyText, getTypeName, parseJson, pushState } from '@/use/utils'
184+
import { asOptions, asStrings, copyText, getTypeName, parseJson, pushState, uniqueIgnoreCase } from '@/use/utils'
185185
import { canAccess, useAuth } from '@/use/auth'
186186
import { Sole } from '@/use/config'
187187
import EnsureAccess from './EnsureAccess.vue'
@@ -507,7 +507,7 @@ function createRequestArgs() {
507507
selectedColumns.push(column)
508508
})
509509
510-
args.fields = selectedColumns.join(',')
510+
args.fields = uniqueIgnoreCase(selectedColumns).join(',')
511511
}
512512
513513
let orderBy:string[] = []

src/use/utils.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,19 @@ export function delay(ms:number) {
222222
return new Promise(resolve => setTimeout(resolve, ms))
223223
}
224224

225+
export function uniqueIgnoreCase(list:string[]) {
226+
const ret:string[] = []
227+
const retLower:string[] = []
228+
for (const x of list) {
229+
const lower = x.toLowerCase()
230+
if (!retLower.includes(lower)) {
231+
ret.push(x)
232+
retLower.push(lower)
233+
}
234+
}
235+
return ret
236+
}
237+
225238
export function useUtils() {
226239
return {
227240
dateInputFormat,
@@ -250,5 +263,6 @@ export function useUtils() {
250263
asOptions,
251264
createDebounce,
252265
delay,
266+
uniqueIgnoreCase,
253267
}
254268
}

0 commit comments

Comments
 (0)