diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index cea9e654c..a42111592 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -6,6 +6,7 @@ import { useRoute } from 'vue-router'; import { useState } from 'src/composables/useState'; import axios from 'axios'; import { useArrayData } from 'composables/useArrayData'; +import { onUnmounted } from 'vue'; const { t } = useI18n(); const route = useRoute(); @@ -109,7 +110,7 @@ watch(storeData, async (val) => { for (let n of state.get('Tree')) { await fetchNodeLeaves(n); } - expanded.value = [null]; + expanded.value = [null, ...fetchedNodeKeys]; } previousExpandedNodes.value = new Set(expanded.value); }); @@ -141,6 +142,10 @@ onMounted(async () => { previousExpandedNodes.value = new Set(expanded.value); }); + +onUnmounted(() => { + state.set('Tree', undefined); +});