x
This commit is contained in:
1 parent
b8873f88b0
commit
807c43ece5
9 files changed
+624
-259
No files matched your search
@@ -9,11 +9,15 @@ import axios from "axios";
|
||||
import FormData from "form-data";
|
||||
import { PAGE_SECTION_TYPES } from "@homaroma/types";
|
||||
|
||||
function getChildrenArray(node: any): any[] {
|
||||
function getChildrenArray(node: any, isRoot?: boolean): any[] {
|
||||
if (Array.isArray(node.columns)) return node.columns;
|
||||
if (Array.isArray(node.links)) return node.links;
|
||||
if (Array.isArray(node.items)) return node.items;
|
||||
if (Array.isArray(node.children)) return node.children;
|
||||
if (isRoot) {
|
||||
node.columns = [];
|
||||
return node.columns;
|
||||
}
|
||||
node.links = [];
|
||||
return node.links;
|
||||
}
|
||||
@@ -956,7 +960,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
||||
if (!found) {
|
||||
throw new Error(`Parent node ${parentId} not found`);
|
||||
}
|
||||
const children = getChildrenArray(found.node);
|
||||
const children = getChildrenArray(found.node, found.parent === null);
|
||||
children.push(nodeData);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user