Skip to content

Fix display template not appearing for relations inside translations on new items#26219

Merged
AlexGaillard merged 16 commits intomainfrom
CMS-1451
Nov 24, 2025
Merged

Fix display template not appearing for relations inside translations on new items#26219
AlexGaillard merged 16 commits intomainfrom
CMS-1451

Conversation

@gaetansenn
Copy link
Contributor

@gaetansenn gaetansenn commented Nov 18, 2025

Scope

What's changed:

  • Fixed translation-form.vue to pass '+' as primaryKey for new translation items instead of null

Potential Risks / Drawbacks

  • None identified. Existing tests pass and new tests added.

Tested Scenarios

  • Add Existing item to M2A/M2M field in new parent, display template now shows correctly
  • Add multiple items from same/different collections, all display correctly
  • Create New item, continues working
  • Pagination, existing behavior preserved

Checklist

  • Added or updated tests
  • Documentation PR created here or not required
  • OpenAPI package PR created here or not required

Fixes #26051

@linear
Copy link

linear bot commented Nov 18, 2025

Copy link
Contributor

@robluton robluton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎸

Copy link
Contributor

@formfcw formfcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @gaetansenn ❤️
Unfortunately, this is not the ideal approach, because the underlying problem is different.

  • Let’s revert the changes and ensure the foreign key of the m2a junction collection is included in the edits object, as demonstrated in the video below. It appears that the property is missing when using in the translation form and the m2a interface, which may be due to incorrect handling of the key.

  • Let’s also address this issue in the M2M field, where it occurs in exactly the same way.

m2a-display-bug.mp4

@gaetansenn gaetansenn changed the title Fix M2A display template not showing when adding items to new parent Fix display template not appearing for relations inside translations on new items Nov 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where display templates were not appearing for relations inside translations when creating new items. The issue occurred because the primary-key prop was being set to null for new translation items instead of the expected '+' convention used throughout Directus.

  • Updated translation-form.vue to use nullish coalescing operator to default to '+' for new items
  • Added changeset documenting the fix

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
app/src/interfaces/translations/translation-form.vue Fixed primary-key logic to use '+' for new translation items instead of null, enabling display templates to render correctly
.changeset/large-adults-repair.md Added changeset entry documenting the bug fix

Copy link
Contributor

@formfcw formfcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @gaetansenn ❤️

  • Let’s add a test for this case.

Copy link
Contributor

@formfcw formfcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @gaetansenn ❤️

LGTM 🎉

Copy link
Member

@AlexGaillard AlexGaillard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY for the 🧪

@AlexGaillard AlexGaillard merged commit 64d938e into main Nov 24, 2025
68 of 69 checks passed
@AlexGaillard AlexGaillard deleted the CMS-1451 branch November 24, 2025 15:41
@github-actions github-actions bot added this to the Next Release milestone Nov 24, 2025
alexlebens pushed a commit to alexlebens/infrastructure that referenced this pull request Dec 11, 2025
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [directus/directus](https://github.com/directus/directus) | minor | `11.13.4` -> `11.14.0` |

---

### Release Notes

<details>
<summary>directus/directus (directus/directus)</summary>

### [`v11.14.0`](https://github.com/directus/directus/releases/tag/v11.14.0)

[Compare Source](directus/directus@v11.13.4...v11.14.0)

##### ⚠️ Potential Breaking Changes

- **[@&#8203;directus/stores](https://github.com/directus/stores)**
  - Removed sidebar states from app store ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))

##### ✨ New Features & Improvements

- **[@&#8203;directus/app](https://github.com/directus/app)**
  - Added support for downloading multiple files and entire folder trees ([#&#8203;26006](directus/directus#26006) by [@&#8203;Nitwel](https://github.com/Nitwel))
  - Added AI chat sidebar ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
  - Added support for float intervals and min/max warnings for number inputs ([#&#8203;26190](directus/directus#26190) by [@&#8203;gaetansenn](https://github.com/gaetansenn))
  - Made both sidebars resizable ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
  - Added header interface ([#&#8203;26302](directus/directus#26302) by [@&#8203;AlexGaillard](https://github.com/AlexGaillard))
- **[@&#8203;directus/api](https://github.com/directus/api)**
  - Added support for downloading multiple files and entire folder trees ([#&#8203;26006](directus/directus#26006) by [@&#8203;Nitwel](https://github.com/Nitwel))
  - Added AI chat sidebar ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
- **[@&#8203;directus/types](https://github.com/directus/types)**
  - Added support for downloading multiple files and entire folder trees ([#&#8203;26006](directus/directus#26006) by [@&#8203;Nitwel](https://github.com/Nitwel))
  - Added AI chat sidebar ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
- **[@&#8203;directus/utils](https://github.com/directus/utils)**
  - Added support for downloading multiple files and entire folder trees ([#&#8203;26006](directus/directus#26006) by [@&#8203;Nitwel](https://github.com/Nitwel))
  - Moved `fetchRolesTree`,`fetchGlobalAccess`, `fetchGlobalAccessForUser` and `fetchGlobalAccessForRoles` to the public utility package ([#&#8203;26248](directus/directus#26248) by [@&#8203;ComfortablyCoding](https://github.com/ComfortablyCoding))
- **[@&#8203;directus/sdk](https://github.com/directus/sdk)**
  - Added support for downloading multiple files and entire folder trees ([#&#8203;26006](directus/directus#26006) by [@&#8203;Nitwel](https://github.com/Nitwel))
- **[@&#8203;directus/system-data](https://github.com/directus/system-data)**
  - Added AI chat sidebar ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
- **[@&#8203;directus/errors](https://github.com/directus/errors)**
  - Added AI chat sidebar ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
- **[@&#8203;directus/themes](https://github.com/directus/themes)**
  - Added AI chat sidebar ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))

##### 🐛 Bug Fixes & Optimizations

- **[@&#8203;directus/app](https://github.com/directus/app)**
  - Fixed an issue where input focus ring disappears on hover ([#&#8203;26315](directus/directus#26315) by [@&#8203;formfcw](https://github.com/formfcw))
  - Fixed display template not appearing for relations inside translations on new items ([#&#8203;26219](directus/directus#26219) by [@&#8203;gaetansenn](https://github.com/gaetansenn))
  - Ensured the created revision uses the correct label ([#&#8203;26289](directus/directus#26289) by [@&#8203;vizzv](https://github.com/vizzv))
  - Added reactive primaryKey prop to useFlows composable ([#&#8203;26287](directus/directus#26287) by [@&#8203;AlexGaillard](https://github.com/AlexGaillard))
- **[@&#8203;directus/api](https://github.com/directus/api)**
  - Added redirect validation ([#&#8203;26346](directus/directus#26346) by [@&#8203;br41nslug](https://github.com/br41nslug))
  - Moved `fetchRolesTree`,`fetchGlobalAccess`, `fetchGlobalAccessForUser` and `fetchGlobalAccessForRoles` to the public utility package ([#&#8203;26248](directus/directus#26248) by [@&#8203;ComfortablyCoding](https://github.com/ComfortablyCoding))
  - Updated synchronization of remotely stored extensions ([#&#8203;26192](directus/directus#26192) by [@&#8203;br41nslug](https://github.com/br41nslug))
  - Fixed missing accountability for `files.upload` when TUS is enabled ([#&#8203;26247](directus/directus#26247) by [@&#8203;br41nslug](https://github.com/br41nslug))
- **[@&#8203;directus/types](https://github.com/directus/types)**
  - Moved `fetchRolesTree`,`fetchGlobalAccess`, `fetchGlobalAccessForUser` and `fetchGlobalAccessForRoles` to the public utility package ([#&#8203;26248](directus/directus#26248) by [@&#8203;ComfortablyCoding](https://github.com/ComfortablyCoding))
  - Updated synchronization of remotely stored extensions ([#&#8203;26192](directus/directus#26192) by [@&#8203;br41nslug](https://github.com/br41nslug))
- **[@&#8203;directus/storage-driver-cloudinary](https://github.com/directus/storage-driver-cloudinary)**
  - Updated synchronization of remotely stored extensions ([#&#8203;26192](directus/directus#26192) by [@&#8203;br41nslug](https://github.com/br41nslug))
- **[@&#8203;directus/storage-driver-supabase](https://github.com/directus/storage-driver-supabase)**
  - Updated synchronization of remotely stored extensions ([#&#8203;26192](directus/directus#26192) by [@&#8203;br41nslug](https://github.com/br41nslug))
- **[@&#8203;directus/extensions-sdk](https://github.com/directus/extensions-sdk)**
  - Updated `esbuild` dependency from 0.25.12 to 0.26.0 ([#&#8203;26215](directus/directus#26215) by [@&#8203;dependabot](https://github.com/dependabot))
- **[@&#8203;directus/system-data](https://github.com/directus/system-data)**
  - Updated `esbuild` dependency from 0.25.12 to 0.26.0 ([#&#8203;26215](directus/directus#26215) by [@&#8203;dependabot](https://github.com/dependabot))
- **[@&#8203;directus/sdk](https://github.com/directus/sdk)**
  - Updated `esbuild` dependency from 0.25.12 to 0.26.0 ([#&#8203;26215](directus/directus#26215) by [@&#8203;dependabot](https://github.com/dependabot))
- **[@&#8203;directus/themes](https://github.com/directus/themes)**
  - Made both sidebars resizable ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))
- **[@&#8203;directus/utils](https://github.com/directus/utils)**
  - Preserved Error when passed to run-script operation ([#&#8203;26234](directus/directus#26234) by [@&#8203;gaetansenn](https://github.com/gaetansenn))
- **[@&#8203;directus/composables](https://github.com/directus/composables)**
  - Set default sidebar shadow to false ([#&#8203;26259](directus/directus#26259) by [@&#8203;rijkvanzanten](https://github.com/rijkvanzanten))

##### 📦 Published Versions

- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/storage-driver-s3@&#8203;12.0.13`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`
- `@directus/[email protected]`

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4zOS4xIiwidXBkYXRlZEluVmVyIjoiNDIuMzkuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiaW1hZ2UiXX0=-->

Reviewed-on: https://gitea.alexlebens.dev/alexlebens/infrastructure/pulls/2365
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App: M2A Display template is not shown when translation is created

5 participants