From 0fb4c97ce35dc188443d0f47bfee7aa9bd643ab4 Mon Sep 17 00:00:00 2001 From: chengfeitao Date: Mon, 29 Jun 2026 23:21:01 +0000 Subject: [PATCH] feat: Sync from internal staging. --- client/web/react/src/AppMobile.tsx | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/client/web/react/src/AppMobile.tsx b/client/web/react/src/AppMobile.tsx index e09c0bc..2fff7a5 100644 --- a/client/web/react/src/AppMobile.tsx +++ b/client/web/react/src/AppMobile.tsx @@ -104,7 +104,27 @@ function AppMobile() { // Ensure 'root' Column exists for the A2UI Renderer let hasRoot = comps.some((c: any) => c.id === 'root'); if (!hasRoot && comps.length > 0) { - let rootChildren = comps.map((c: any) => c.id).filter((id: any) => id); + // If no "root" exists, generating a new "root" container. + let referencedChildIds = new Set(); + comps.forEach((c: any) => { + if (typeof c.child === 'string') referencedChildIds.add(c.child); + if (c.children) { + if (Array.isArray(c.children)) { + c.children.forEach((child: any) => { + if (typeof child === 'string') referencedChildIds.add(child); + else if (child && typeof child === 'object' && child.id) referencedChildIds.add(child.id); + }); + } else if (typeof c.children === 'object' && c.children.componentId) { + referencedChildIds.add(c.children.componentId); + } + } + }); + + // Filter the components that are not claimed as a child by anyone + let rootChildren = comps + .filter((c: any) => c.id && !referencedChildIds.has(c.id)) + .map((c: any) => c.id); + comps.unshift({ id: 'root', component: 'Column',