Browse Source

Merge pull request #7919 from nocodb/nc-fix/links-excluded-list-modal-offset-bug

Nc fix/links excluded list modal offset bug
pull/7925/head
Pranav C 8 months ago committed by GitHub
parent
commit
b3a0809883
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 11
      packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue
  2. 9
      packages/nc-gui/composables/useLTARStore.ts

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

@ -51,6 +51,7 @@ const {
unlink,
row,
headerDisplayValue,
resetChildrenExcludedOffsetCount
} = useLTARStoreOrThrow()
const { addLTARRef, isNew, removeLTARRef, state: rowState } = useSmartsheetRowStoreOrThrow()
@ -101,6 +102,9 @@ watch(
}
loadChildrenExcludedList(rowState.value)
}
if(!nextVal){
resetChildrenExcludedOffsetCount()
}
},
{
immediate: true,
@ -255,6 +259,11 @@ onUnmounted(() => {
childrenExcludedListPagination.query = ''
window.removeEventListener('keydown', linkedShortcuts)
})
const onFilterChange = () => {
childrenExcludedListPagination.page = 1;
resetChildrenExcludedOffsetCount()
}
</script>
<template>
@ -285,7 +294,7 @@ onUnmounted(() => {
:placeholder="`${$t('general.searchIn')} ${relatedTableMeta?.title}`"
class="w-full !rounded-md nc-excluded-search xs:min-h-8"
size="small"
@change="childrenExcludedListPagination.page = 1"
@change="onFilterChange"
@keydown.capture.stop="
(e) => {
if (e.key === 'Escape') {

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

@ -65,6 +65,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
query: '',
size: 10,
})
const childrenExcludedOffsetCount = ref(0)
const childrenListPagination = reactive({
@ -190,8 +191,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
const loadChildrenExcludedList = async (activeState?: any) => {
if (activeState) newRowState.state = activeState
try {
// todo: confirm the use case of `childrenExcludedOffsetCount.value`
let offset = childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1)
let offset = childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1) - childrenExcludedOffsetCount.value
if (offset < 0) {
offset = 0
@ -550,6 +550,10 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
})
})
const resetChildrenExcludedOffsetCount = () =>{
childrenExcludedOffsetCount.value = 0;
}
return {
relatedTableMeta,
loadRelatedTableMeta,
@ -580,6 +584,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
getRelatedTableRowId,
headerDisplayValue,
relatedTableDisplayValuePropId,
resetChildrenExcludedOffsetCount
}
},
'ltar-store',

Loading…
Cancel
Save