mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix infinite recursion (#17609)
* fix infinite recursion * ran eslint --------- Co-authored-by: Brainslug <tim@brainslug.nl>
This commit is contained in:
@@ -15,6 +15,7 @@ export type FieldNode = {
|
||||
type: Type;
|
||||
children?: FieldNode[];
|
||||
group?: boolean;
|
||||
_loading?: boolean;
|
||||
};
|
||||
|
||||
export type FieldTreeContext = {
|
||||
@@ -94,7 +95,9 @@ export function useFieldTree(
|
||||
if (children) {
|
||||
for (const child of children) {
|
||||
if (child.relatedCollection) {
|
||||
child.children = getTree(child.relatedCollection, child);
|
||||
child.children = [
|
||||
{ name: 'Loading...', field: '', collection: '', key: '', path: '', type: 'alias', _loading: true },
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,6 +195,10 @@ export function useFieldTree(
|
||||
|
||||
const node = getNodeAtPath(path.split('.'), treeList.value);
|
||||
|
||||
if (node && node.children?.length === 1 && node.children[0]._loading) {
|
||||
node.children = getTree(node.relatedCollection, node);
|
||||
}
|
||||
|
||||
for (const child of node?.children || []) {
|
||||
if (child?.relatedCollection) {
|
||||
child.children = getTree(child.relatedCollection, child);
|
||||
|
||||
Reference in New Issue
Block a user