From d2036dc7be5ce04b5d2c4f6bcea30dd2091cdd3b Mon Sep 17 00:00:00 2001 From: Pranav C Date: Fri, 22 Mar 2024 10:40:14 +0000 Subject: [PATCH] fix: reset offset count when closing modal or when filter query changes --- .../virtual-cell/components/LinkedItems.vue | 15 ++++++++++++++- .../virtual-cell/components/UnLinkedItems.vue | 1 + packages/nc-gui/composables/useLTARStore.ts | 7 ++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/virtual-cell/components/LinkedItems.vue b/packages/nc-gui/components/virtual-cell/components/LinkedItems.vue index 443e1d2c34..5762c2c0d6 100644 --- a/packages/nc-gui/components/virtual-cell/components/LinkedItems.vue +++ b/packages/nc-gui/components/virtual-cell/components/LinkedItems.vue @@ -59,6 +59,7 @@ const { link, meta, headerDisplayValue, + resetChildrenListOffsetCount, } = useLTARStoreOrThrow() const { isNew, state, removeLTARRef, addLTARRef } = useSmartsheetRowStoreOrThrow() @@ -69,6 +70,11 @@ watch( if ((nextVal[0] || nextVal[1]) && !isNew.value) { loadChildrenList() } + + // reset offset count when closing modal + if (!nextVal[0]) { + resetChildrenListOffsetCount() + } }, { immediate: true }, ) @@ -207,9 +213,16 @@ watch(childrenListPagination, () => { }) onUnmounted(() => { + resetChildrenListOffsetCount() childrenListPagination.query = '' window.removeEventListener('keydown', linkedShortcuts) }) + +const onFilterChange = () => { + childrenListPagination.page = 1 + // reset offset count when filter changes + resetChildrenListOffsetCount() +}