From f2340424e0e0c6618d70c9e0173d879b6c016f47 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 19 Sep 2022 13:33:17 +0800 Subject: [PATCH] feat(nc-gui): reset state to avoid from showing the previous stacks when switching kanban views --- packages/nc-gui/components/smartsheet/Kanban.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Kanban.vue b/packages/nc-gui/components/smartsheet/Kanban.vue index 041d82bab1..9276046893 100644 --- a/packages/nc-gui/components/smartsheet/Kanban.vue +++ b/packages/nc-gui/components/smartsheet/Kanban.vue @@ -12,6 +12,7 @@ import { OpenNewRecordFormHookInj, ReadonlyInj, inject, + onMounted, provide, useKanbanViewData, } from '#imports' @@ -161,9 +162,9 @@ const handleCollapseStack = async (stackIdx: number) => { const handleExpandedFormCancel = () => { // remove the empty record - formattedData.value['Uncategorized'].pop() + formattedData.value.Uncategorized.pop() // decrease total count by 1 - countByStack.value['Uncategorized'] -= 1 + countByStack.value.Uncategorized -= 1 } openNewRecordFormHook?.on(async (stackTitle) => { @@ -173,10 +174,16 @@ openNewRecordFormHook?.on(async (stackTitle) => { [groupingField.value]: stackTitle, } // increase total count by 1 - countByStack.value['Uncategorized'] += 1 + countByStack.value.Uncategorized += 1 // open the expanded form expandForm(newRow) }) + +onMounted(() => { + // reset state to avoid from showing the previous stacks when switching kanban views + groupingFieldColOptions.value = [] + formattedData.value = {} +})