7525-devToTest #419

Merged
alexm merged 177 commits from 7525-devToTest into test 2024-06-04 08:06:27 +00:00
1 changed files with 19 additions and 1 deletions
Showing only changes of commit f4807d887f - Show all commits

View File

@ -82,10 +82,28 @@ const onSelected = async (val, node) => {
}
};
function getNodeIds(node) {
let ids = [];
if (node.id) ids.push(node.id);
if (node.childs) {
node.childs.forEach((child) => {
ids = ids.concat(getNodeIds(child));
});
}
return ids;
}
watch(storeData, async (val) => {
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
nodes.value[0].children = [...val];
await fetchNodeLeaves(1);
const fetchedNodeKeys = val.flatMap(getNodeIds);
state.set('Tree', [...fetchedNodeKeys]);
const tree = state.get('Tree');
for (let n of tree) {
await fetchNodeLeaves(n);
}
expanded.value = [null, 1, ...fetchedNodeKeys];
});
onMounted(async (n) => {