forked from verdnatura/salix-front
Handle params search on mounted
This commit is contained in:
parent
f4807d887f
commit
1347e4ec40
|
@ -94,7 +94,9 @@ function getNodeIds(node) {
|
|||
return ids;
|
||||
}
|
||||
|
||||
watch(storeData, async (val) => {
|
||||
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];
|
||||
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
||||
|
@ -104,9 +106,15 @@ watch(storeData, async (val) => {
|
|||
await fetchNodeLeaves(n);
|
||||
}
|
||||
expanded.value = [null, 1, ...fetchedNodeKeys];
|
||||
});
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
onMounted(async (n) => {
|
||||
onMounted(async () => {
|
||||
if (store.userParams?.search) {
|
||||
await arrayData.fetch({ append: false });
|
||||
return;
|
||||
}
|
||||
const tree = [...state.get('Tree'), 1];
|
||||
const lastStateTree = state.get('TreeState');
|
||||
if (tree) {
|
||||
|
|
Loading…
Reference in New Issue