Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collection display template doesn't show related field #7577

Closed
3 tasks done
Oreilles opened this issue Aug 24, 2021 · 1 comment · Fixed by #7628 or #7733
Closed
3 tasks done

Collection display template doesn't show related field #7577

Oreilles opened this issue Aug 24, 2021 · 1 comment · Fixed by #7628 or #7733
Assignees
Labels

Comments

@Oreilles
Copy link
Contributor

Oreilles commented Aug 24, 2021

Preflight Checklist

Describe the Bug

When setting a display template with relational fields for a collection, for exemple {{id}}, {{id_client.name}}, the related values used to show correctly. It is no longer the case, and any relational field now shows as --.

Maybe related to #7081 ?

To Reproduce

  • Create two collections, one containing a relational column to the other
  • Set collection A display template to something referencing some field of collection B
  • Create and navigate to an item individual page to see the rendered template.

What version of Directus are you using?

9.0.0-rc.91

What version of Node.js are you using?

Official docker image default

What database are you using?

Postgres

What browser are you using?

Firefox

What operating system are you using?

macOS

How are you deploying Directus?

Docker

@Oreilles
Copy link
Contributor Author

Oreilles commented Aug 31, 2021

Strangely enough, #7628 seemed to have fixed the template rendering in the header bar, but not inside the layout. For exemple, in the map layout, the items pop-up on hover still showed false.

This is because of this:

for (const key in values) {
if (typeof values[key] === 'object') values[key] = JSON.stringify(values[key]);
}

Since all relational values are necessarily objects, they are stringified and then micromustache cannot render them as it cannot access the item props.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants