Browse Source

fix: avoid reloading data for hook filter

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/5624/head
mertmit 2 years ago
parent
commit
e6193c57f9
  1. 2
      packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue
  2. 2
      packages/nc-gui/components/webhook/Editor.vue
  3. 9
      packages/nc-gui/composables/useViewFilters.ts

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

@ -64,6 +64,7 @@ const {
() => reloadDataHook.trigger(showLoading), () => reloadDataHook.trigger(showLoading),
modelValue || nestedFilters.value, modelValue || nestedFilters.value,
!modelValue, !modelValue,
webHook,
) )
const localNestedFilters = ref() const localNestedFilters = ref()
@ -249,6 +250,7 @@ defineExpose({
:parent-id="filter.id" :parent-id="filter.id"
nested nested
:auto-save="autoSave" :auto-save="autoSave"
:web-hook="webHook"
/> />
</div> </div>
</template> </template>

2
packages/nc-gui/components/webhook/Editor.vue

@ -710,7 +710,7 @@ onMounted(async () => {
:auto-save="false" :auto-save="false"
:show-loading="false" :show-loading="false"
:hook-id="hook.id" :hook-id="hook.id"
web-hook :web-hook="true"
/> />
</a-card> </a-card>
</a-col> </a-col>

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

@ -29,6 +29,7 @@ export function useViewFilters(
reloadData?: () => void, reloadData?: () => void,
_currentFilters?: Filter[], _currentFilters?: Filter[],
isNestedRoot?: boolean, isNestedRoot?: boolean,
isWebhook?: boolean,
) { ) {
let currentFilters = $ref(_currentFilters) let currentFilters = $ref(_currentFilters)
@ -238,7 +239,7 @@ export function useViewFilters(
} }
} }
reloadData?.() if (!isWebhook) reloadData?.()
} catch (e: any) { } catch (e: any) {
console.log(e) console.log(e)
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
@ -308,7 +309,7 @@ export function useViewFilters(
lastFilters.value = clone(filters.value) lastFilters.value = clone(filters.value)
reloadData?.() if (!isWebhook) reloadData?.()
} }
const deleteFilter = async (filter: Filter, i: number, undo = false) => { const deleteFilter = async (filter: Filter, i: number, undo = false) => {
@ -335,7 +336,7 @@ export function useViewFilters(
if (nestedMode.value) { if (nestedMode.value) {
filters.value.splice(i, 1) filters.value.splice(i, 1)
filters.value = [...filters.value] filters.value = [...filters.value]
reloadData?.() if (!isWebhook) reloadData?.()
} else { } else {
if (filter.id) { if (filter.id) {
// if auto-apply disabled mark it as disabled // if auto-apply disabled mark it as disabled
@ -346,7 +347,7 @@ export function useViewFilters(
} else { } else {
try { try {
await $api.dbTableFilter.delete(filter.id) await $api.dbTableFilter.delete(filter.id)
reloadData?.() if (!isWebhook) reloadData?.()
filters.value.splice(i, 1) filters.value.splice(i, 1)
} catch (e: any) { } catch (e: any) {
console.log(e) console.log(e)

Loading…
Cancel
Save