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

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

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

Loading…
Cancel
Save