Browse Source

Merge pull request #8716 from nocodb/nc-fix/filter-bugs

Nc fix/filter bugs
pull/8718/head
Pranav C 7 months ago committed by GitHub
parent
commit
c87d976faa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/nc-gui/components/smartsheet/toolbar/SearchData.vue
  2. 15
      packages/nc-gui/composables/useViewFilters.ts

2
packages/nc-gui/components/smartsheet/toolbar/SearchData.vue

@ -128,7 +128,7 @@ onClickOutside(globalSearchWrapperRef, (e) => {
</template>
</NcDropdown>
<form class="p-0">
<form class="p-0" @submit.prevent>
<a-input
v-if="search.query || showSearchBox"
ref="globalSearchRef"

15
packages/nc-gui/composables/useViewFilters.ts

@ -21,6 +21,8 @@ export function useViewFilters(
isLink?: boolean,
linkColId?: Ref<string>,
) {
const savingStatus: Record<number, boolean> = {}
const parentId = ref(_parentId)
const currentFilters = ref(_currentFilters)
@ -337,6 +339,13 @@ export function useViewFilters(
}
const saveOrUpdate = async (filter: Filter, i: number, force = false, undo = false, skipDataReload = false) => {
// if already in progress the debounced function which will call this function again with 500ms delay until it's not saving
if (savingStatus[i]) {
return saveOrUpdateDebounced(filter, i, force, undo, skipDataReload)
} else {
savingStatus[i] = true
}
if (!view.value && !linkColId?.value) return
if (!undo) {
@ -377,8 +386,8 @@ export function useViewFilters(
filters.value = [...filters.value]
} else if (!autoApply?.value && !force) {
filter.status = filter.id ? 'update' : 'create'
} else if (filter.id && filter.status !== 'create') {
await $api.dbTableFilter.update(filter.id, {
} else if (filters.value[i]?.id && filter.status !== 'create') {
await $api.dbTableFilter.update(filters.value[i].id!, {
...filter,
fk_parent_id: parentId.value,
})
@ -405,6 +414,8 @@ export function useViewFilters(
} catch (e: any) {
console.log(e)
message.error(await extractSdkResponseErrorMsg(e))
} finally {
savingStatus[i] = false
}
lastFilters.value = clone(filters.value)

Loading…
Cancel
Save