mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix field tree not updating appropriately. (#9118)
* Fix field tree not updating appropriately. * Reset visitedRelations on collection change.
This commit is contained in:
@@ -27,21 +27,21 @@ export function useFieldTree(
|
||||
|
||||
const tree = ref<FieldTree>({});
|
||||
|
||||
if (collection.value) {
|
||||
tree.value = getFieldTreeForCollection(collection.value, 'any');
|
||||
}
|
||||
|
||||
watch(collection, () => {
|
||||
if (collection.value) {
|
||||
tree.value = getFieldTreeForCollection(collection.value, 'any');
|
||||
}
|
||||
});
|
||||
|
||||
const visitedRelations = ref<string[][]>([]);
|
||||
|
||||
Object.values(tree.value).forEach((value) => {
|
||||
loadFieldRelations(value.field);
|
||||
});
|
||||
watch(
|
||||
collection,
|
||||
() => {
|
||||
if (collection.value) {
|
||||
tree.value = getFieldTreeForCollection(collection.value, 'any');
|
||||
visitedRelations.value = [];
|
||||
Object.values(tree.value).forEach((value) => {
|
||||
loadFieldRelations(value.field);
|
||||
});
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const treeList = computed(() => treeToList(tree.value));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user