Skip to content

content/docs/guide/layout.md 的 app-shell「Schema API」块教了 7 个 AppShellProps 从未声明的键(header/body/headerClassName/... ),照抄的 JSON 全部静默丢弃 #4827

Description

@yinlianghui

发现于 #4817 的实施(PR 见该单),回传立单。未认领,交 PM 三角。

事实(基线 f6f213b06 实测)

#4817 修的是 packages/layout/README.md 的 AppShell 示例(React props 载体)。同一个幻影键事实在第三个教学面上成体系存在,而且是 JSON 载体 —— content/docs/guide/layout.md

app-shell 这个组件键注册到的就是 packages/layout 的 AppShell(packages/layout/src/index.ts:153),且注册时没有声明任何 inputs:

ComponentRegistry.register('app-shell', AppShell, {
namespace: 'layout',
label: 'App Shell',
category: 'Layout',
});

AppShellProps(packages/layout/src/AppShell.tsx:25-40)声明的全部键是:
sidebar / navbar / children / className / defaultOpen / branding / rightRail
组件解构(:233-241)是固定键表、无 rest

content/docs/guide/layout.md 的 app-shell「Schema API」块(:73-88)教的是:

{
type: 'app-shell',
header?: ComponentSchema,
sidebar?: ComponentSchema,
sidebarCollapsible?: boolean,
sidebarDefaultOpen?: boolean,
body: ComponentSchema,
className?: string,
headerClassName?: string,
sidebarClassName?: string,
contentClassName?: string
}

10 个键里 只有 sidebarclassName 是真的。其余 7 个 —— headersidebarCollapsiblesidebarDefaultOpenbodyheaderClassNamesidebarClassNamecontentClassName —— AppShellProps 一个都没有。同页 :478-486 的「Custom Classes」JSON 示例把其中 4 个又演示了一遍:

{
"type": "app-shell",
"className": "custom-app",
"headerClassName": "bg-primary text-primary-foreground",
"sidebarClassName": "bg-muted",
"contentClassName": "bg-background",
"body": {...}
}

为什么这不是 #4817 / #4808 的重复

三条既有钉子的扫描面都写死在各自的文件上(readme-sidebar-nav-example.test.ts→README、app-shell-docs-nav-example.test.ts→app-shell.mdx、#4817 新加的 readme-app-shell-example.test.ts→README 的 AppShell 段),没有一条覆盖 content/docs/guide/*.md

影响

JSON 载体比 React 载体更糟:React 侧照抄至少 TypeScript 消费者会拿到编译错误,而 JSON metadata 没有这道关 —— app-shell 注册时 inputs 为空,sdui-parser 的 unknown-prop 检查也就无从报起(同族:#3972 正是「注册面与实现不符导致校验说不出话」)。所以照 guide 写出的 app-shell 节点:顶栏内容(header)不渲染、主内容(body)不渲染、三个 *ClassName 全部无效,而且全程零诊断。这是 AI 作者最容易照抄的那种面。

未审计的部分(留给分诊)

同文件 :155-172page「Schema API」块也声明了 body / headerClassName / bodyClassName / maxWidth / padding / actions,但那个键解析到的是 @object-ui/componentsPageRenderer(见 README :95-99 的说明),不是本单核对的 AppShell —— 我没有核对它,不在本单的事实范围内。

参考

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions