directus / directus/directus

M2A Relation Display Not Showing Properly

Open
#25,348 5 comments 0 reactions 0 assignees View on GitHub
Bug Help Wanted Low Reach Med Impact Studio UX / DX
Dominant language
TypeScript
Stars
37.9k
Forks
4.9k
Avg merge
3d 21h
Merged PRs (30d)
36

Description

### To Reproduce

1. Create 3 collections:
* `collection_one` with `name` field (set as display template)
* `collection_two` with `title` field (set as display template)
* `collection_three`

![Image](https://uploads.linear.app/8d64f771-381d-4a46-a408-28b4fcc13d22/9a3f2f41-c300-4966-a4bf-95aea9b93576/f126c483-a078-477c-84cf-8cb2e8e13c79?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzhkNjRmNzcxLTM4MWQtNGE0Ni1hNDA4LTI4YjRmY2MxM2QyMi85YTNmMmY0MS1jMzAwLTQ5NjYtYTRiZi05NWFlYTliOTM1NzYvZjEyNmM0ODMtYTA3OC00NzdjLTg0Y2YtOGNiMmU4ZTEzYzc5IiwiaWF0IjoxNzczNjc3NzIyLCJleHAiOjE4MDUyNDgyODJ9.Ud7Pu5F6XId6fLHrcFGt9PKh83JreU0Y0K-UlXNH-mw)

2. Configure M2A relation on `collection_three`:
* Select the Related Collections: `collection_one`, `collection_two`
* Interface: Leave it empty as default
* Display: Choose "Related Values"
3. Create items:
* Add records in `collection_one` (e.g., `{name: "Ahmed"}`)
* Add records in `collection_two` (e.g., `{title: "Admin"}`)
4. Link records in `collection_three`

### Describe the Bug

What you will notice after the steps you have done is the following:
Interface works perfectly thanks to the recent PR ([https://github.com/directus/directus/pull/24503]()):

![Image](https://uploads.linear.app/8d64f771-381d-4a46-a408-28b4fcc13d22/76ce0437-6d53-4083-b037-f3ee5777f288/fec1ff09-4413-4094-8aa7-a4c224457fd6?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzhkNjRmNzcxLTM4MWQtNGE0Ni1hNDA4LTI4YjRmY2MxM2QyMi83NmNlMDQzNy02ZDUzLTQwODMtYjAzNy1mM2VlNTc3N2YyODgvZmVjMWZmMDktNDQxMy00MDk0LThhYTctYTRjMjI0NDU3ZmQ2IiwiaWF0IjoxNzczNjc3NzIyLCJleHAiOjE4MDUyNDgyODJ9.Ii7VHDbnzd8QCsK4YK-XkT2NgI7Uwmash2Zuc-ephGA)

But it's not working properly in the display:

![Image](https://uploads.linear.app/8d64f771-381d-4a46-a408-28b4fcc13d22/80c6ad11-3de3-448b-ac62-36781c374de5/49b5080b-054c-4422-a0e3-48960d45c09c?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzhkNjRmNzcxLTM4MWQtNGE0Ni1hNDA4LTI4YjRmY2MxM2QyMi84MGM2YWQxMS0zZGUzLTQ0OGItYWM2Mi0zNjc4MWMzNzRkZTUvNDliNTA4MGItMDU0Yy00NDIyLWEwZTMtNDg5NjBkNDVjMDljIiwiaWF0IjoxNzczNjc3NzIyLCJleHAiOjE4MDUyNDgyODJ9.yicOE2nIO7u0aj-LUeS10wwHqaM6bI0MbjghoGF3sig)

And if you added the related values manually in the display tab for example like this:
`{{collection}}: {{item:collection_one}} {{item:collection_two}}`
it shows like this:

![Image](https://uploads.linear.app/8d64f771-381d-4a46-a408-28b4fcc13d22/ca097664-848a-42e7-a06e-1b1222748adc/32c0842e-e3f3-496e-b061-634ef3e0ca87?signature=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXRoIjoiLzhkNjRmNzcxLTM4MWQtNGE0Ni1hNDA4LTI4YjRmY2MxM2QyMi9jYTA5NzY2NC04NDhhLTQyZTctYTA2ZS0xYjEyMjI3NDhhZGMvMzJjMDg0MmUtZTNmMy00OTZlLWIwNjEtNjM0ZWYzZTBjYTg3IiwiaWF0IjoxNzczNjc3NzIyLCJleHAiOjE4MDUyNDgyODJ9.4BjLfiOkDgeiJvX-Thlv95NLMkVEJX3YWlc8zc65grY)

Expected Result:
Same as the interface, it should show the collection name then the "display template" for the collection which is in our case `title` or `name`

### Directus Version

v11.8.0

### Hosting Strategy

Self-Hosted (Docker Image)

### Database

*No response*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.