VirtusLab-Open-Source/strapi-plugin-navigation

Strapi v5: No hierarchy in render output

Closed this issue · 3 comments

Hi!

I'm brand new to this plugin, so please forgive me if the issue is caused by my misconfiguration.

I am using:
Strapi: v5.0.1
strapi-plugin-navigation: 3.0.0-beta.0

I built the following simple navigation structure:

image

When I now query GET http://localhost:1337/api/navigation/render/top-navigation?type=TREE, I was expecting to receive an hierarchical structure of elements, so that "Preise" and "Produkte" are both elements of the items property of the "Home" element.

But what I receive is this flat JSON response:

[
    {
        "id": 10,
        "title": "Home",
        "menuAttached": true,
        "order": 1,
        "path": "/home",
        "type": "INTERNAL",
        "uiRouterKey": "home-1",
        "slug": "home-1",
        "related": {
            "id": 15,
            "documentId": "ta8kkfjnawaqhx3ovvg7tvmo",
            "title": "Home",
            "createdAt": "2024-09-25T13:44:43.271Z",
            "updatedAt": "2024-10-01T17:01:22.449Z",
            "publishedAt": "2024-10-01T17:01:22.458Z",
            "locale": "de",
            "navItemName": "Home",
            "slug": null,
            "alternativeTabTitle": null,
            "uid": "api::page.page",
            "__templateName": "Generic"
        },
        "items": [],
        "collapsed": false,
        "appendSeparator": "appendSeparator"
    },
    {
        "id": 11,
        "title": "Preise",
        "menuAttached": false,
        "order": 1,
        "path": "/preise",
        "type": "INTERNAL",
        "uiRouterKey": "preise-1",
        "slug": "preise-1",
        "related": {
            "id": 1,
            "documentId": "zris0a0ol23nyf2obgzgbjak",
            "title": "Preise",
            "createdAt": "2024-10-01T15:51:23.583Z",
            "updatedAt": "2024-10-01T16:18:52.857Z",
            "publishedAt": "2024-10-01T16:18:52.852Z",
            "locale": "de",
            "addSeparator": "None",
            "uid": "api::raw-nav-item.raw-nav-item",
            "__templateName": "Generic"
        },
        "items": [],
        "collapsed": false
    },
    {
        "id": 12,
        "title": "Produkte",
        "menuAttached": false,
        "order": 2,
        "path": "/produkte",
        "type": "INTERNAL",
        "uiRouterKey": "produkte-1",
        "slug": "produkte-1",
        "related": {
            "id": 2,
            "documentId": "ja119odcqq85oy7bcxk351el",
            "title": "Produkte",
            "createdAt": "2024-10-01T15:51:56.854Z",
            "updatedAt": "2024-10-01T16:18:57.065Z",
            "publishedAt": "2024-10-01T16:18:57.062Z",
            "locale": "de",
            "addSeparator": "None",
            "uid": "api::raw-nav-item.raw-nav-item",
            "__templateName": "Generic"
        },
        "items": [],
        "collapsed": false
    }
]

Why is that and what can I do to get the actual nav tree structure ?

Thanks!

This issue is most probably connected with change from is to document id and i18n. We have got beta.1 in progress and and aiming to release early next week.

@cyp3rius That's great to hear, thanks for the quick response.

Looking forward to the beta.1 release!

The issue was fixed in the released version 3.0.0-beta.1.