Skip to content

IBX-10602: Refactored NodeFactory to fetch translations for n first items with a new endpoint fetching translated names#1777

Open
barw4 wants to merge 6 commits into4.6from
ibx-10602-content-tree-refactor
Open

IBX-10602: Refactored NodeFactory to fetch translations for n first items with a new endpoint fetching translated names#1777
barw4 wants to merge 6 commits into4.6from
ibx-10602-content-tree-refactor

Conversation

@barw4
Copy link
Contributor

@barw4 barw4 commented Nov 24, 2025

🎫 Issue IBX-10602

Description:

  • Refactored NodeFactory to accept an optional translationsLimit parameter, allowing the content tree to fetch translated names only for the first N items (passed via translationsLimit query param on the load-subtree endpoint) instead of all children, improving performance for large trees.
  • Added a new REST endpoint GET /api/ibexa/v2/content/objects/translated-names-list that returns translated names for a given set of content IDs. This allows the frontend to lazily load translations for remaining items on demand.
  • Introduced TranslatedNamesList REST Value + TranslatedNamesListVisitor output visitor

New endpoint

Route: GET /api/ibexa/v2/content/objects/translated-names-list

Example request

GET /api/ibexa/v2/content/objects/translated-names-list?content_ids[]=57&content_ids[]=41
Accept: application/vnd.ibexa.api.ContentTreeTranslatedNamesList+json

Example response

{
    "ContentTreeTranslatedNamesList": {
        "_media-type": "application/vnd.ibexa.api.ContentTreeTranslatedNamesList+json",
        "entries": [
            {
                "contentId": 57,
                "languages": {
                    "eng-GB": "Home"
                }
            },
            {
                "contentId": 41,
                "languages": {
                    "eng-US": "Media"
                }
            }
        ]
    }
}

For QA:

Documentation:

@sonarqubecloud
Copy link

@barw4 barw4 changed the title IBX-10602: Refactored NodeFactory to fetch translations for n first items [POC] IBX-10602: Refactored NodeFactory to fetch translations for n first items Nov 24, 2025
@barw4 barw4 force-pushed the ibx-10602-content-tree-refactor branch from 99a8ce1 to e3dc3e3 Compare March 3, 2026 10:43
@barw4 barw4 marked this pull request as ready for review March 4, 2026 20:08
@barw4 barw4 changed the title [POC] IBX-10602: Refactored NodeFactory to fetch translations for n first items IBX-10602: Refactored NodeFactory to fetch translations for n first items Mar 4, 2026
@barw4 barw4 changed the title IBX-10602: Refactored NodeFactory to fetch translations for n first items IBX-10602: Refactored NodeFactory to fetch translations for n first items with a new endpoint fetching translated names Mar 4, 2026
@barw4 barw4 requested a review from a team March 5, 2026 08:45
@barw4 barw4 requested a review from a team March 9, 2026 09:09
@ibexa-workflow-automation-1 ibexa-workflow-automation-1 bot requested review from Steveb-p, ViniTou, alongosz, ciastektk, konradoboza, mikadamczyk, tbialcz and wiewiurdp and removed request for a team March 9, 2026 09:09
@barw4 barw4 force-pushed the ibx-10602-content-tree-refactor branch from b2671cb to ceaad12 Compare March 10, 2026 08:46
@micszo micszo force-pushed the ibx-10602-content-tree-refactor branch from ceaad12 to 13432a4 Compare March 12, 2026 08:36
<entry>
<contentId>57</contentId>
<languages>
<eng-GB>Home</eng-GB>
Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, this is not a valid XML - code should not be the type of an element.

You could "fix" this both in JSON and XML if you instead provided a list of objects with language code + name properties.

If it changes the shape of the response, frontend might need to map this into the shape they want later.

Note

Given how we treat XML, consider this suggestion optional

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's changed to a better structure

@barw4 barw4 requested a review from Steveb-p March 16, 2026 09:24
#

ibexa.rest.location.tree.load_translated_names_by_content_ids:
path: /content/objects/translated-names-list
Copy link
Member

Choose a reason for hiding this comment

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

naming: we expose on API level "content items", "content object" is a legacy name

Copy link
Contributor Author

@barw4 barw4 Mar 16, 2026

Choose a reason for hiding this comment

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

what would be example name in this case? I don't think we have anything with content items yet.

Comment on lines +220 to +222
$contentInfos = $contentService->loadContentInfoList($contentIds);

$versionInfoList = $contentService->loadVersionInfoListByContentInfo($contentInfos);
Copy link
Member

Choose a reason for hiding this comment

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

Optional: Given we're touching here performance, you might consider creating dedicated ContentService::load* method for this, instead of performing 2 operations.

We might want to tackle it, if further performance issues arise, this is not a "must" for me.

@barw4 barw4 requested a review from alongosz March 16, 2026 10:28
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants