Browse Source

fix: handle singular response for user cell

pull/7373/head
mertmit 11 months ago
parent
commit
60e3533354
  1. 9
      packages/nc-gui/components/cell/User.vue

9
packages/nc-gui/components/cell/User.vue

@ -27,7 +27,7 @@ import {
import MdiCloseCircle from '~icons/mdi/close-circle'
interface Props {
modelValue?: UserFieldRecordType[] | string | null
modelValue?: UserFieldRecordType[] | UserFieldRecordType | string | null
rowIndex?: number
location?: 'cell' | 'filter'
forceMulti?: boolean
@ -113,8 +113,8 @@ const vModel = computed({
return acc
}, [] as { label: string; value: string }[])
} else {
selected =
modelValue?.reduce((acc, item) => {
selected = modelValue
? (Array.isArray(modelValue) ? modelValue : [modelValue]).reduce((acc, item) => {
const label = item?.display_name || item?.email
if (label) {
acc.push({
@ -123,7 +123,8 @@ const vModel = computed({
})
}
return acc
}, [] as { label: string; value: string }[]) || []
}, [] as { label: string; value: string }[])
: []
}
return selected

Loading…
Cancel
Save