π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): record search issue
Ramesh Mane6ff00ca8784b
diff --git a/packages/nc-gui/components/n/RecordPicker/Records.vue b/packages/nc-gui/components/n/RecordPicker/Records.vueindex 993d704ad7..facb2ab65c 100644--- a/packages/nc-gui/components/n/RecordPicker/Records.vue+++ b/packages/nc-gui/components/n/RecordPicker/Records.vue@@ -87,7 +87,7 @@ const { cachedRows, loadData, syncCount, totalRows, chunkStates, clearCache } =viewMeta,where: computedWhere,callbacks: {- getWhereFilter: async (path, ignoreWhereFilter) => (ignoreWhereFilter ? '' : computedWhere.value),+ getWhereFilter: async (_path, ignoreWhereFilter) => (ignoreWhereFilter ? '' : computedWhere.value),},disableSmartsheet: true,})@@ -129,7 +129,8 @@ const fetchChunk = async (chunkId: number, isInitialLoad = false) => {}try {const newItems = await loadData({ offset, limit })- newItems.forEach((item) => cachedRows.value.set(item.rowMeta.rowIndex, item))++ newItems.forEach((item) => cachedRows.value.set(item.rowMeta.rowIndex!, item))chunkStates.value[chunkId] = 'loaded'if (isInitialLoad) {@@ -243,9 +244,8 @@ useScroll(scrollWrapper, {behavior: 'smooth',})-watch(where, async () => {+watch(computedWhere, async () => {if (records?.value?.length) {- console.log('search like', where.value)const filteredRecords = searchLike(records.value, `%${where.value}%`)totalRows.value = filteredRecords.lengthconst tempCachedRows = new Map()@@ -260,7 +260,9 @@ watch(where, async () => {cachedRows.value = tempCachedRows} else {await syncCount()- await loadData()+ const newItems = await loadData()+ newItems.forEach((item) => cachedRows.value.set(item.rowMeta.rowIndex!, item))+calculateSlices()await updateVisibleRows()}@@ -280,7 +282,9 @@ onMounted(async () => {totalRows.value = records.value.length} else {await syncCount()- await loadData()+ const newItems = await loadData()+ newItems.forEach((item) => cachedRows.value.set(item.rowMeta.rowIndex!, item))+calculateSlices()await updateVisibleRows()}diff --git a/packages/nc-gui/composables/useInfiniteData.ts b/packages/nc-gui/composables/useInfiniteData.tsindex f8cf67d48e..a66c6e81f7 100644--- a/packages/nc-gui/composables/useInfiniteData.ts+++ b/packages/nc-gui/composables/useInfiniteData.ts@@ -380,13 +380,13 @@ export function useInfiniteData(args: {where?: string} = {},_shouldShowLoading?: boolean,- path?: Array<number> = [],+ path: Array<number> = [],): Promise<Row[]> {if ((!base?.value?.id || !meta.value?.id || !viewMeta.value?.id) && !isPublic?.value) return []const whereFilter = await callbacks?.getWhereFilter?.(path)- if (!path.length && params.offset && blockExternalSourceRecordVisibility(isExternalSource.value)) {+ if (!disableSmartsheet && !path.length && params.offset && blockExternalSourceRecordVisibility(isExternalSource.value)) {if (!isAlreadyShownUpgradeModal.value && params.offset >= EXTERNAL_SOURCE_VISIBLE_ROWS) {isAlreadyShownUpgradeModal.value = true@@ -434,6 +434,9 @@ export function useInfiniteData(args: {loadAggCommentsCount(data, path)++ console.log('response', data)+return data} catch (error: any) {if (error?.response?.data.error === 'INVALID_OFFSET_VALUE') {@@ -1689,14 +1692,14 @@ export function useInfiniteData(args: {...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }),})- if (!path.length && blockExternalSourceRecordVisibility(isExternalSource.value)) {+ if (!disableSmartsheet && !path.length && blockExternalSourceRecordVisibility(isExternalSource.value)) {totalRowsWithoutSearchQuery.value = Math.max(Math.min(200, _count as number), _count as number)} else {totalRowsWithoutSearchQuery.value = _count as number}}- if (!path.length && blockExternalSourceRecordVisibility(isExternalSource.value)) {+ if (!disableSmartsheet && !path.length && blockExternalSourceRecordVisibility(isExternalSource.value)) {dataCache.totalRows.value = Math.min(200, count as number)} else {dataCache.totalRows.value = count as number