π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
refactor: remove redundant emit calls in selector components since v-model handles updates
DarkPhoenix2704459c7ecb61c0
diff --git a/packages/nc-gui/components/nc/List/AggregationSelector.vue b/packages/nc-gui/components/nc/List/AggregationSelector.vueindex 116ef2bb70..b182e88b96 100644--- a/packages/nc-gui/components/nc/List/AggregationSelector.vue+++ b/packages/nc-gui/components/nc/List/AggregationSelector.vue@@ -36,7 +36,6 @@ const isOpenAggregationSelectDropdown = ref(false)const handleValueUpdate = (value: any) => {const stringValue = String(value)modelValue.value = stringValue- emit('update:value', stringValue)}const column = ref<ColumnType | null>(null)@@ -121,9 +120,8 @@ watch(aggregationList, (newAggregationList) => {// Check if current value exists in the new aggregation listif (modelValue.value && !newAggregationListMap.has(modelValue.value)) {- // Current value is not in the list, emit null to clear it+ // Current value is not in the list, set null to clear itmodelValue.value = undefined- emit('update:value', undefined)return}@@ -132,7 +130,6 @@ watch(aggregationList, (newAggregationList) => {const newAggregationValue = newAggregationList[0]?.valuemodelValue.value = newAggregationValue- emit('update:value', newAggregationValue)}}}, { immediate: true })diff --git a/packages/nc-gui/components/nc/List/ColumnSelector.vue b/packages/nc-gui/components/nc/List/ColumnSelector.vueindex 48b3772e23..bdd520a5e4 100644--- a/packages/nc-gui/components/nc/List/ColumnSelector.vue+++ b/packages/nc-gui/components/nc/List/ColumnSelector.vue@@ -37,7 +37,6 @@ const isOpenColumnSelectDropdown = ref(false)const handleValueUpdate = (value: any) => {const stringValue = String(value)modelValue.value = stringValue- emit('update:value', stringValue)}const columnList = computedAsync(async () => {@@ -92,9 +91,8 @@ watch(columnList, (newColumnList) => {// Check if current value exists in the new column listif (modelValue.value && !newColumnListMap.has(modelValue.value)) {- // Current value is not in the list, emit null to clear it+ // Current value is not in the list, set null to clear itmodelValue.value = undefined- emit('update:value', undefined)return}@@ -108,10 +106,8 @@ watch(columnList, (newColumnList) => {if (columnObj && columnObj.ncItemDisabled && columnObj.value === newColumnList[0]?.value) {const selectedValue = newColumnList.find((column) => !column.ncItemDisabled)?.value || newColumnList[0]?.valuemodelValue.value = selectedValue- emit('update:value', selectedValue)} else {modelValue.value = newColumnId- emit('update:value', newColumnId)}}}diff --git a/packages/nc-gui/components/nc/List/TableSelector.vue b/packages/nc-gui/components/nc/List/TableSelector.vueindex 6b87c238d3..94641fe651 100644--- a/packages/nc-gui/components/nc/List/TableSelector.vue+++ b/packages/nc-gui/components/nc/List/TableSelector.vue@@ -37,7 +37,6 @@ const isOpenTableSelectDropdown = ref(false)const handleValueUpdate = (value: any) => {const stringValue = String(value)modelValue.value = stringValue- emit('update:value', stringValue)}const tableList = computedAsync(async () => {@@ -85,9 +84,8 @@ watch(tableList, (newTableList) => {// Check if current value exists in the new table listif (modelValue.value && !newTableListMap.has(modelValue.value)) {- // Current value is not in the list, emit null to clear it+ // Current value is not in the list, set null to clear itmodelValue.value = null- emit('update:value', null)return}@@ -100,10 +98,8 @@ watch(tableList, (newTableList) => {if (tableObj && tableObj.ncItemDisabled && tableObj.value === newTableList[0]?.value) {const selectedValue = newTableList.find((table) => !table.ncItemDisabled)?.value || newTableList[0]?.valuemodelValue.value = selectedValue- emit('update:value', selectedValue)} else {modelValue.value = newTableId- emit('update:value', newTableId)}}}diff --git a/packages/nc-gui/components/nc/List/ViewSelector.vue b/packages/nc-gui/components/nc/List/ViewSelector.vueindex ad52198593..dd4164d759 100644--- a/packages/nc-gui/components/nc/List/ViewSelector.vue+++ b/packages/nc-gui/components/nc/List/ViewSelector.vue@@ -40,7 +40,6 @@ const isOpenViewSelectDropdown = ref(false)const handleValueUpdate = (value: any) => {const stringValue = String(value)modelValue.value = stringValue- emit('update:value', stringValue)}const viewList = computedAsync(async () => {@@ -97,9 +96,8 @@ watch(viewList, (newViewList) => {// Check if current value exists in the new view listif (modelValue.value && !newViewListMap.has(modelValue.value)) {- // Current value is not in the list, emit null to clear it+ // Current value is not in the list, set null to clear itmodelValue.value = undefined- emit('update:value', undefined)return}@@ -113,10 +111,8 @@ watch(viewList, (newViewList) => {if (viewObj && viewObj.ncItemDisabled && viewObj.value === newViewList[0]?.value) {const selectedValue = newViewList.find((view) => !view.ncItemDisabled)?.value || newViewList[0]?.valuemodelValue.value = selectedValue- emit('update:value', selectedValue)} else {modelValue.value = newViewId- emit('update:value', newViewId)}}}