Browse Source

feat(nc-gui): reset state to avoid from showing the previous stacks when switching kanban views

pull/3818/head
Wing-Kam Wong 2 years ago
parent
commit
f2340424e0
  1. 13
      packages/nc-gui/components/smartsheet/Kanban.vue

13
packages/nc-gui/components/smartsheet/Kanban.vue

@ -12,6 +12,7 @@ import {
OpenNewRecordFormHookInj, OpenNewRecordFormHookInj,
ReadonlyInj, ReadonlyInj,
inject, inject,
onMounted,
provide, provide,
useKanbanViewData, useKanbanViewData,
} from '#imports' } from '#imports'
@ -161,9 +162,9 @@ const handleCollapseStack = async (stackIdx: number) => {
const handleExpandedFormCancel = () => { const handleExpandedFormCancel = () => {
// remove the empty record // remove the empty record
formattedData.value['Uncategorized'].pop() formattedData.value.Uncategorized.pop()
// decrease total count by 1 // decrease total count by 1
countByStack.value['Uncategorized'] -= 1 countByStack.value.Uncategorized -= 1
} }
openNewRecordFormHook?.on(async (stackTitle) => { openNewRecordFormHook?.on(async (stackTitle) => {
@ -173,10 +174,16 @@ openNewRecordFormHook?.on(async (stackTitle) => {
[groupingField.value]: stackTitle, [groupingField.value]: stackTitle,
} }
// increase total count by 1 // increase total count by 1
countByStack.value['Uncategorized'] += 1 countByStack.value.Uncategorized += 1
// open the expanded form // open the expanded form
expandForm(newRow) expandForm(newRow)
}) })
onMounted(() => {
// reset state to avoid from showing the previous stacks when switching kanban views
groupingFieldColOptions.value = []
formattedData.value = {}
})
</script> </script>
<template> <template>

Loading…
Cancel
Save