π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): show error if search query is not valid
Ramesh Maned18874c3b86a
diff --git a/packages/nc-gui/components/n/RecordPicker/Records.vue b/packages/nc-gui/components/n/RecordPicker/Records.vueindex e2681710f8..e4012b41e2 100644--- a/packages/nc-gui/components/n/RecordPicker/Records.vue+++ b/packages/nc-gui/components/n/RecordPicker/Records.vue@@ -63,6 +63,14 @@ const computedWhere = computed(() => {return fieldQuery})+const isValidSearchQuery = computed(() => {+ const searchQuery = where.value?.trim()++ if (!searchQuery) return true++ return !!(searchQuery && computedWhere.value)+})+const { cachedRows, loadData, syncCount, totalRows, chunkStates, clearCache } = useInfiniteData({meta,viewMeta,@@ -280,6 +288,13 @@ onMounted(async () => {const wrapperHeight = computed(() => {return totalRows.value * ROW_HEIGHT})++/**+ * Expose the isValidSearchQuery to the parent component+ */+defineExpose({+ isValidSearchQuery,+})</script><template>diff --git a/packages/nc-gui/components/n/RecordPicker/index.vue b/packages/nc-gui/components/n/RecordPicker/index.vueindex 336049ff66..70cde03c5a 100644--- a/packages/nc-gui/components/n/RecordPicker/index.vue+++ b/packages/nc-gui/components/n/RecordPicker/index.vue@@ -137,7 +137,17 @@ const resolveInput = async (row: Row) => {isOpen.value = false}+const filterQueryRef = ref<{ input: HTMLInputElement }>()++const recordsRef = ref()++const isValidSearchQuery = computed(() => {+ if (!recordsRef.value) return true++ return recordsRef.value?.isValidSearchQuery+})+whenever(isOpen, () => {if (!isOpen.value) returnsetTimeout(() => {@@ -197,11 +207,17 @@ whenever(isOpen, () => {<template #prefix><GeneralIcon icon="search" class="nc-search-icon mr-2 h-4 w-4 text-gray-500" /></template>+ <template v-if="!isValidSearchQuery" #suffix>+ <NcTooltip title="Invalid search query for visible fields">+ <GeneralIcon icon="ncInfo" class="h-4 w-4 text-nc-content-red-medium" />+ </NcTooltip>+ </template></a-input></div></div><NRecordPickerRecordsv-if="!isLoading"+ ref="recordsRef":view-meta="viewMeta":data="records":fields="fields"