Option to provide the nodePath in addNewComponentToLayout

Created on 28 August 2025, about 18 hours ago

Overview

When adding components using the page builder agent, the response sent to the frontend is in the following format format

{
    "status": true,
    "operations": [
        {
            "operation": "ADD",
            "components": [
                {
                    "id": "sdc.starshot_demo.starshot-columns",
                    "nodePath": [
                        1,
                        0
                    ],
                    "fieldValues": {
                        "cols": "two",
                        "gap": "medium",
                        "alignment": "none"
                    }
                },
                {
                    "id": "sdc.starshot_demo.starshot-button",
                    "nodePath": [
                        1,
                        0,
                        0,
                        0
                    ],
                    "fieldValues": {
                        "text": "Read more",
                        "url": "https:\/\/example.com\/read-more-1",
                        "display": "primary"
                    }
                },
                {
                    "id": "sdc.starshot_demo.starshot-button",
                    "nodePath": [
                        1,
                        0,
                        1,
                        0
                    ],
                    "fieldValues": {
                        "text": "Read more",
                        "url": "https:\/\/example.com\/read-more-2",
                        "display": "primary"
                    }
                }
            ]
        }
    ],
}

The nodePath value was calculated for each component to be added, and then passed to addNewComponentToLayout to place it in the required position (e.g in a specific region, above or below another component, or inside a specific slot).

But now, after 📌 Formalize an API for programmatically updating prop values Active got merged, it is no longer possible to pass the nodePath value to the function and therefore the component placement is broken

Proposed resolution

User interface changes

🐛 Bug report
Status

Active

Version

1.0

Component

AI

Created by

🇮🇳India Akhil Babu Chengannur

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Akhil Babu
  • 🇮🇳India Akhil Babu Chengannur

    The nodePath value is critical to place each component at its intended position. For example, if only the content region is enabled and there are no components placed on a page, to add a component like sdc.example.two-column with two sdc.example.heading components in each slot, we could previously calculate the nodePath like this:

    • sdc.example.two-column → [0, 0]
    • first sdc.example.heading → [0, 0, 0, 0]
    • second sdc.example.heading → [0, 0, 1, 0]

    Then, components could be added one by one using addNewComponentToLayout. It would be great if we could bring back the ability to give nodePath directly in the method itself.

Production build 0.71.5 2024