Browse Source

fix: reset children excluded list offset when closing the modal to avoid unexpected behaviour

pull/7919/head
Pranav C 8 months ago
parent
commit
db7f68c9a3
  1. 4
      packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue
  2. 10
      packages/nc-gui/composables/useLTARStore.ts

4
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,

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

@ -186,8 +186,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
const loadChildrenExcludedList = async (activeState?: any) => {
if (activeState) newRowState.state = activeState
try {
let offset =
childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1) - childrenExcludedOffsetCount.value
// todo: confirm the use case of `childrenExcludedOffsetCount.value`
let offset = childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1) - childrenExcludedOffsetCount.value
if (offset < 0) {
offset = 0
@ -540,6 +540,10 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
})
})
const resetChildrenExcludedOffsetCount = () =>{
childrenExcludedOffsetCount.value = 0;
}
return {
relatedTableMeta,
loadRelatedTableMeta,
@ -569,6 +573,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
deleteRelatedRow,
getRelatedTableRowId,
headerDisplayValue,
relatedTableDisplayValuePropId,
resetChildrenExcludedOffsetCount
}
},
'ltar-store',

Loading…
Cancel
Save