diff --git a/packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue b/packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue index 7419a0db30..dc9a6f7cd0 100644 --- a/packages/nc-gui/components/virtual-cell/components/UnLinkedItems.vue +++ b/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, diff --git a/packages/nc-gui/composables/useLTARStore.ts b/packages/nc-gui/composables/useLTARStore.ts index e0bcb2e0b8..e9e4d67269 100644 --- a/packages/nc-gui/composables/useLTARStore.ts +++ b/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',