From 2c18060f50801e6be03b4aedc64feeae0e0ae781 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Thu, 28 Nov 2024 02:06:59 +0000 Subject: [PATCH] fix:missing data --- .../nc-gui/components/cell/MultiSelect.vue | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui/components/cell/MultiSelect.vue b/packages/nc-gui/components/cell/MultiSelect.vue index 919280cacc..8adc8d6382 100644 --- a/packages/nc-gui/components/cell/MultiSelect.vue +++ b/packages/nc-gui/components/cell/MultiSelect.vue @@ -63,19 +63,17 @@ const { isPg, isMysql } = useBase() // temporary until it's add the option to column meta const tempSelectedOptsState = reactive([]) -const tempColumn = ref(column.value) - const options = computed<(SelectOptionType & { value?: string })[]>(() => { if (column?.value.colOptions) { - const opts = tempColumn.value.colOptions - ? (tempColumn.value.colOptions as SelectOptionsType).options.filter((el: SelectOptionType) => el.title !== '') || [] + const opts = column.value.colOptions + ? (column.value.colOptions as SelectOptionsType).options.filter((el: SelectOptionType) => el.title !== '') || [] : [] for (const op of opts.filter((el: SelectOptionType) => el.order === null)) { op.title = op.title?.replace(/^'/, '').replace(/'$/, '') } let order = 1 const limitOptionsById = - ((parseProp(tempColumn.value.meta)?.limitOptions || []).reduce( + ((parseProp(column.value.meta)?.limitOptions || []).reduce( (o: Record, f: FormFieldsLimitOptionsType) => { if (order < (f?.order ?? 0)) { order = f.order @@ -91,8 +89,8 @@ const options = computed<(SelectOptionType & { value?: string })[]>(() => { if ( !isEditColumn.value && isForm.value && - parseProp(tempColumn.value.meta)?.isLimitOption && - (parseProp(tempColumn.value.meta)?.limitOptions || []).length + parseProp(column.value.meta)?.isLimitOption && + (parseProp(column.value.meta)?.limitOptions || []).length ) { return opts .filter((o: SelectOptionType) => { @@ -148,7 +146,7 @@ const selectedTitles = computed(() => modelValue ? Array.isArray(modelValue) ? modelValue - : isMysql(tempColumn.value.source_id) + : isMysql(column.value.source_id) ? modelValue .toString() .split(',') @@ -282,7 +280,8 @@ async function addIfMissingAndSave() { updatedColMeta, ) - tempColumn.value = data.columns.find((c) => c.id === column.value.id) + + column.value.colOptions = data.columns.find((c) => c.id === column.value.id).colOptions activeOptCreateInProgress.value-- if (!activeOptCreateInProgress.value) { @@ -492,8 +491,8 @@ const onFocus = () => { :key="op.id || op.title" :value="op.title" class="gap-2" - :data-testid="`select-option-${tempColumn.title}-${location === 'filter' ? 'filter' : rowIndex}`" - :class="`nc-select-option-${tempColumn.title}-${op.title}`" + :data-testid="`select-option-${column.title}-${location === 'filter' ? 'filter' : rowIndex}`" + :class="`nc-select-option-${column.title}-${op.title}`" @click.stop >