From 045a828bf93f0c322c560902ad8e52bb137aa8f3 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 14 Nov 2024 13:59:04 +0100 Subject: [PATCH] fix(ZoneCard): fix ZoneLocations redirections --- src/pages/Zone/Card/ZoneLocationsTree.vue | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/pages/Zone/Card/ZoneLocationsTree.vue b/src/pages/Zone/Card/ZoneLocationsTree.vue index 89231f75e..b0a97b2f6 100644 --- a/src/pages/Zone/Card/ZoneLocationsTree.vue +++ b/src/pages/Zone/Card/ZoneLocationsTree.vue @@ -42,16 +42,15 @@ const arrayData = useArrayData(datakey, { const { store } = arrayData; const storeData = computed(() => store.data); -const nodes = ref([ - { - id: null, - name: props.rootLabel, - sons: true, - tickable: false, - noTick: true, - children: [{}], - }, -]); +const defaultNode = { + id: null, + name: props.rootLabel, + sons: true, + tickable: false, + noTick: true, + children: [{}], +}; +const nodes = ref([defaultNode]); const _tickedNodes = computed({ get: () => props.tickedNodes, @@ -131,6 +130,7 @@ function getNodeIds(node) { watch(storeData, async (val) => { // Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar + if (!nodes.value[0]) nodes.value = [defaultNode]; nodes.value[0].childs = [...val]; const fetchedNodeKeys = val.flatMap(getNodeIds); state.set('Tree', [...fetchedNodeKeys]); @@ -196,7 +196,7 @@ onUnmounted(() => { - +