fix(plugin-detail): 相关列表的 Add 门改问 add.picker.object,漏写 picker 不再把整块换成红卡 (#3838) - #3894
Merged
Merged
Conversation
…红卡 (#3838) `record:related_list` 写了 `add` 却漏了 `add.picker` 时,`RelatedList.tsx:1293` 的门只判 `add` 真值,紧接着 `:1299` 裸取 `add.picker.object` 抛 TypeError,`SchemaRenderer` 捕获后把**整个相关列表**换成 「Component "record:related_list" failed to render」错误卡 —— 报错文案里 没有 `picker` 三个字。`picker` 在 spec(`RecordRelatedListProps.add`)里是必填, `RelatedListProps` 也把它声明为必填(这正是裸取能通过 TS 的原因),但渲染路径上 没有任何一处解析 schema(sdui-parser 的 manifest 门只比顶层键名与粗类型), 所以不合规元数据一路抵达裸取。 - Add 按钮(`:1121`)与 picker 对话框(`:1293`)的门统一收紧为 `add && pickerObject`,`:1299` 改用文件里已有的 `pickerObject` (即 `add?.picker?.object`)—— 渲染路径上最后一处 `add.picker` 裸取消失, 而不是给它加可选链:缺 `picker` 的 `add` 仍旧什么都不做,不产生第二方言 (AGENTS.md #0.1)。与 `:378`/`:390` 既有可选链同向。 - 具名诊断:缺 `add.picker.object` 时按文件内既有的「no referenceField/parentId」 开发者提示先例,console.warn 点名缺失的键。`renderers/record-related-list.tsx` 的整块 placeholder 先例适用于「整块无可渲染」(缺 objectName),这里列表主体 完好、只有 Add 未配置,故不套用。 - 钉子测试三例:缺 picker → 主体照常渲染 + 无 Add + 诊断点名;合法 add → Add 照常且打开 picker 目标;无 add → 现状不变且不告警。 - apps/console 两个 reach 探针里描述该崩溃与旧门形状的注释同步更正(仅注释, 样本与断言未动)。 (c) 产出端(save-gate / `os build`)真正跑一次 spec 解析仍是最正的方向,不在本单。
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Collaborator
Author
|
✅ 验收(PM,session 实物核验:头 裁定要点:
转 ready 并挂 auto-merge。越界 #3895(Add 按钮不判 dataSource 的产品取舍:补门 vs disabled+说明)归分诊席。 Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3838
前提复核(先证后改)
:1299,按内容锚定复核过:grep -n "add\.picker" packages/plugin-detail/src/RelatedList.tsx只有:724/:734/:1299三处裸取,前两处在handleAddRecords回调内、:723有if (!add || !dataSource || …) return前置,不在渲染路径 —— 未动。picker必填:RecordRelatedListProps.safeParse({ objectName, relationshipField, add: { label: 'Add' } })报invalid_typeon path["add","picker"]。也就是说触发者只能是不合规元数据;而渲染路径上没有任何一处解析 schema,所以它一路抵达裸取。RelatedListProps.add.picker在 TS 里被声明为必填(RelatedList.tsx:84)—— 这正是裸取当年能通过 type-check 的原因:类型声明可信,运行时拿到的是未校验 JSON。改了什么
方向按分诊缺省 (a) 收紧门 + (b) 具名诊断:
:1121)与 picker 对话框(:1293)的门统一收紧为add && pickerObject,:1299改用文件里已有的pickerObject(即add?.picker?.object,原本就为 picker schema 预取而算过一次)。add.picker裸取消失,而不是给它加可选链 —— 后者是消费端宽容(AGENTS.md #0.1),会让缺picker的add变成一种"能用"的第二方言。现在它仍旧什么都不做,只是从「炸整块」变成「Add affordance 不渲染」,与同一路径上:378/:390既有的可选链同向。:1293会留下一个点了没有对话框可开的死按钮。add.picker.object时console.warn点名缺失的键(旧的报错文案里根本没有picker三个字)。renderers/record-related-list.tsx的整块 dashed placeholder 先例,语义是「这个块什么都渲染不出来」(缺objectName→ 没有任何数据可取;同族的record:path — no stages、record:quick_actions — no actions同理)。这里不是那个情形 —— 列表主体、计数、分页、行操作全都正常,只有 Add 一个 affordance 缺配置,把一个能用的列表换成一行虚线提示是净损失。:405-416,no referenceField/parentId — refusing to fetch all rows):同样是"降级一个行为、点名一个键"的 console.warn,放在 effect 里(每次挂载/配置变化告警一次,不随每次渲染刷屏)。apps/console两个 reach 探针里把该崩溃与旧门形状写成现存事实的注释更正为过去时(parity 门的反方向没推到全仓:7 个 block 共 15 个 spec 已声明的顶层键没有任何inputs发布,其中 3 个渲染器实读(record:details.hideFields/record:related_list.relationshipValueField/element:text_input.defaultValue) #3808 留下的历史说明保留)。只改注释,fixture 样本与断言一行未动 ——add: { picker: { object } }本来就是 spec 合法样本,与本 PR 无关地成立。反向验证(方向先判后跑)
预判(写在跑之前):只还原
:1293的旧门与裸取、保留新加的 warn effect 与收紧后的按钮门 → 缺 picker 的钉子红在同一个 TypeError 上,且具名诊断依然不出现(render 先抛,effect 根本轮不到 flush),合法样本两例保持绿。TypeError: Cannot read properties of undefined (reading 'object')@RelatedList.tsx:1299:34:1293(保留 warn):1331:34,warn 从未触发预判与实测一致。第三行是这次真正的信息量:门才是承重的那条腿 —— warn effect 单独存在时是装饰性的,因为抛异常发生在 effect flush 之前;所以 (b) 必须叠在 (a) 上,不能替代它。
测试
pnpm exec vitest run packages/plugin-detail/src/__tests__/RelatedList.addPickerGuard.test.tsx→ 3 passed(新钉子)pnpm exec vitest run packages/plugin-detail→ 60 files / 493 tests passed(消费半径:plugin-detail 全量)pnpm exec vitest run apps/console/src/__tests__/record-block-record-reach.test.tsx apps/console/src/__tests__/public-block-binding-reach.test.tsx→ 2 files / 29 passedpnpm exec turbo run type-check --concurrency=2→ 78 successful, 78 totalpnpm run check:control-bytes→ OK(3780 tracked files)flock /tmp/os-heavy-verify.lock+NODE_OPTIONS=--max-old-space-size=4096+--maxWorkers=2下不在本单
os build)仍是最正的方向 —— 它才能在发布时拒绝这种元数据,而本 PR 只改变已在野坏元数据的渲染后果。范围远超本单。record:related_list.add.picker.filter全仓零读点:作者限定了 Add 选择器的候选范围,对话框照样提供该对象的全部记录 #3831(add.picker.filter未接线)另单,未碰。:724/:734回调内的裸取:有前置 return 且现在只能由已通过新门的对话框触发,按 issue 结论未动。基线:
origin/main@47f60785474ca68889a376bd0dff7aedec5d2725。Generated by Claude Code