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

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

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

Loading…
Cancel
Save