Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

element:* 的规范拼写 properties 不参与表达式求值,而被注释称作 legacy alias 的 props 参与 —— 写规范形态反而丢表达式 #4799

Closed

Description

@yinlianghui

发现于 #4786 的实施,真实 SchemaRenderer 探针实测。

实测

dataSource { total: 99 }:

@@PROBE element:text/props+expr        text="99"              ({type:'element:text', props:{content:'${data.total}'}})
@@PROBE element:text/properties+expr   text="${data.total}"   ({type:'element:text', properties:{content:'${data.total}'}})

静态值两边都正常(element:text/props 与 element:text/properties 都渲染 HELLO)。差别只在表达式。

成因

  • packages/components/src/renderers/basic/elements.tsx 的 readProps() 合并两边,注释明说 properties 是规范拼写、props 是 legacy alias:

    Per spec, element components carry their config in schema.properties.
    Tolerate schema.props (legacy alias) so JSON written either way works.

    且 properties 后写,优先级更高。

  • packages/react/src/SchemaRenderer.tsx 的 evaluation memo 只对 newSchema.props 逐值跑 evaluator.evaluate(...),properties 没有对应分支。memo 里另有一段把 properties.* 提到节点顶层(newSchema[k] = v),但 newSchema.properties 仍指向原始未求值对象,而 renderer 读的正是 schema.properties —— 所以提升那一步对 element:* 没有任何作用。

后果

按 spec 规范拼写写 element:* 节点的作者,表达式静默失效(上屏字面量);写"legacy alias"的反而正常。这与仓内一贯的 contract-first 方向(AGENTS.md #0.1)正好相反:宽容的那条路被喂饱了,规范的那条路被饿着。

element:* 是 #4786 的教学面改写里被明确保留为"信封合法"的唯一命名空间(protocol.md 新增的例外条款),所以这条不一致会直接落在照着新规则写的作者头上。

修法方向

对齐两者:evaluation memo 里对 newSchema.properties 做与 props 同样的逐值求值(并保持 properties 优先)。属渲染器改动,#4786 明令零改 packages/**,故单列。

参考

Activity

  1. added theissue type on Aug 17, 2026
  2. os-zhuang commented on Aug 17, 2026

    @os-zhuang
    Contributor

    Triage: pm:queue, type Bug. The canonical spec spelling (properties) silently loses expression evaluation while the legacy alias (props) works — inverse of contract-first, measured with renderer probes. Fix direction per card: the evaluation memo in packages/react/src/SchemaRenderer.tsx treats newSchema.properties like props (keeping properties precedence). Serial note: same evaluation-memo surface as the #4795/#4797 decision axis — this mechanical alias-parity fix does not pre-empt those rulings, but if they land first, re-price.


    Generated by Claude Code

  3. self-assigned this
    on Aug 18, 2026
  4. yinlianghui commented on Aug 18, 2026

    @yinlianghui
    ContributorAuthor

    认领(PM 派发,objectui 分片):session_01GTRjn8xBqp75dk7kFupVRt,分支 claude/issue-4799-properties-expr-parity,os-dev 席即将开工。

    范围声明:packages/react/src/SchemaRenderer.tsx 的 evaluation memo(对 newSchema.properties 做与 props 同样的逐值求值,保持 properties 优先)+ 测试 + changeset。序列关系:与 #4795 方向 3(未求值表达式响亮诊断,维护者已裁)同文件 —— 本单先行,已在 #4795 留排序注记(评论 5321998544);D3 排 #4799 落 main 之后的空席。与在飞席位(plugin-grid src、plugin-view.mdx、plugin-form README、plugin-detail/RelatedList)文件不相交。


    Generated by Claude Code

  5. added a commit that references this issue on Aug 23, 2026
    0046d8f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions