Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Subobjects not shown or crash Admin

Open
#538 0 comments 0 reactions 0 assignees View on GitHub

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;

image

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;

image

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;

image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from api-platform/admin

All issues in api-platform/admin

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.