Subobjects not shown or crash Admin
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- php, react, typescript
- Domain
- frontend
Research direction
Start with the linked adminTest reproduction and trace how the Admin renders API relationships when readableLink is true or false. Reproduce the collection and single-object cases, then verify that subobjects display correctly and that the Admin no longer crashes with data.map or invalid element errors.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- TypeScript
- Stars
- 516
- Forks
- 134
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from api-platform/admin
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
api-platform/admin#616 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 64/100
api-platform/admin#660 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
api-platform/admin#659 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
api-platform/admin#631 · 6 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
api-platform/admin#626 · 1 comment · 1 reaction ·
All issues in api-platform/admin
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100