Browse Source

Merge pull request #7942 from nocodb/nc-fix/offset-in-links-modal

fix: Reset offset count when closing modal or when filter query changes
pull/7950/head
Pranav C 8 months ago committed by GitHub
parent
commit
f888191545
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      packages/nc-gui/components/virtual-cell/components/LinkedItems.vue
  2. 1
      packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue
  3. 7
      packages/nc-gui/composables/useLTARStore.ts

15
packages/nc-gui/components/virtual-cell/components/LinkedItems.vue

@ -59,6 +59,7 @@ const {
link,
meta,
headerDisplayValue,
resetChildrenListOffsetCount,
} = useLTARStoreOrThrow()
const { isNew, state, removeLTARRef, addLTARRef } = useSmartsheetRowStoreOrThrow()
@ -69,6 +70,11 @@ watch(
if ((nextVal[0] || nextVal[1]) && !isNew.value) {
loadChildrenList()
}
// reset offset count when closing modal
if (!nextVal[0]) {
resetChildrenListOffsetCount()
}
},
{ immediate: true },
)
@ -207,9 +213,16 @@ watch(childrenListPagination, () => {
})
onUnmounted(() => {
resetChildrenListOffsetCount()
childrenListPagination.query = ''
window.removeEventListener('keydown', linkedShortcuts)
})
const onFilterChange = () => {
childrenListPagination.page = 1
// reset offset count when filter changes
resetChildrenListOffsetCount()
}
</script>
<template>
@ -242,7 +255,7 @@ onUnmounted(() => {
:placeholder="`Search in ${relatedTableMeta?.title}`"
class="w-full !sm:rounded-md xs:min-h-8 !xs:rounded-xl"
size="small"
@change="childrenListPagination.page = 1"
@change="onFilterChange"
@keydown.capture.stop="
(e) => {
if (e.key === 'Escape') {

1
packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue

@ -256,6 +256,7 @@ onMounted(() => {
})
onUnmounted(() => {
resetChildrenExcludedOffsetCount()
childrenExcludedListPagination.query = ''
window.removeEventListener('keydown', linkedShortcuts)
})

7
packages/nc-gui/composables/useLTARStore.ts

@ -554,6 +554,10 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
childrenExcludedOffsetCount.value = 0;
}
const resetChildrenListOffsetCount = () => {
childrenListOffsetCount.value = 0
}
return {
relatedTableMeta,
loadRelatedTableMeta,
@ -584,7 +588,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
getRelatedTableRowId,
headerDisplayValue,
relatedTableDisplayValuePropId,
resetChildrenExcludedOffsetCount
resetChildrenExcludedOffsetCount,
resetChildrenListOffsetCount,
}
},
'ltar-store',

Loading…
Cancel
Save