Subobjects not shown or crash Admin
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- php, react, typescript
- 领域
- frontend
调研方向
从链接的 adminTest 复现开始,跟踪 readableLink 为 true 或 false 时 Admin 如何渲染 API 关系。复现 collection 和单对象的情况,然后验证子对象能够正确显示,并确认 Admin 不再因 data.map 或无效元素错误而崩溃。
由索引模型根据 Issue 内容生成。
描述
API Platform version(s) affected: 3.2.16
Description
With readableLink false Collection displayed as links, single is empty:
#[Groups(groups: ['Main:write'])]
#[ORM\OneToMany(mappedBy: 'main', targetEntity: Sub::class, orphanRemoval: true, cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
#[ApiProperty(readableLink: false, writableLink: false)]
private Collection $subs;
#[Groups(groups: ['Main:write'])]
#[ApiProperty(readableLink: false, writableLink: false)]
#[ORM\ManyToOne(inversedBy: 'mains', cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
private ?One $one = null;
With readableLink true Collection displayed as json:
#[Groups(groups: ['Main:write'])]
#[ORM\OneToMany(mappedBy: 'main', targetEntity: Sub::class, orphanRemoval: true, cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
#[ApiProperty(readableLink: true, writableLink: true)]
private Collection $subs;
With readableLink true Object, Admin crashes:
#[Groups(groups: ['Main:write'])]
#[ApiProperty(readableLink: true, writableLink: true)]
#[ORM\ManyToOne(inversedBy: 'mains', cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
private ?One $one = null;
Unhandled Runtime Error
TypeError: data.map is not a function
Unhandled Runtime Error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `CustomError`.
How to reproduce
Full example: https://github.com/ili101/api-platform/tree/adminTest
- 主要语言
- TypeScript
- 星标
- 515
- 派生
- 134
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
api-platform/admin 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
api-platform/admin#616 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 64/100
api-platform/admin#660 ·
-
难度 4/5 3-5 天 新手友好度 50/100
api-platform/admin#659 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 35/100
api-platform/admin#631 · 6 条评论 ·
-
难度 4/5 3-5 天 新手友好度 35/100
api-platform/admin#626 · 1 条评论 · 1 个 reaction ·
查看 api-platform/admin 的全部 Issue
相似的 Issue
-
needs:triage
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
ai-discovered
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
jessepollak/home#1627 ·
维护者通常 1 天内回复
-
agent-canvas bug llm priority:low ready-for-dev
难度 2/5 1-3 小时 新手友好度 82/100
OpenHands/OpenHands#17806 · 3 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
radius-project/ai-extensions#923 ·
维护者通常 1 天内回复