Bug in "open" property, not synchronized with internal "$open" property

Based on answers in my 2 earlier posts, I know understand that this in fact a bug.

  1. Problems with duration and end date - how to re-trigger end_date calculation - Gantt - DHTMLX
  2. Difference between task.open and task.$open - Gantt - DHTMLX

The open and $open property should be synchronized. As a workaround, I do something like

        this._gantt.attachEvent(Gantt.DHTMLX_EVENTS.ON_TASK_OPENED, (id) => {
            const task = gantt.getTask(id);
            task.open = task.$open;
            this._bufferEvent({id: id, type: Gantt.AGNICO_EVENTS.TASK_UPDATED, task: this.createShallowCopy(gantt.getTask(id))});
        });
<!DOCTYPE html>

<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>Basic initialization</title>
    <script src="../../codebase/dhtmlxgantt.js?v=9.0.13"></script>
    <link rel="stylesheet" href="../../codebase/dhtmlxgantt.css?v=9.0.13">
    <style>
        html,
        body {
            height: 100%;
            padding: 0px;
            margin: 0px;
            overflow: hidden;
        }
    </style>
</head>

<body>
<div id="gantt_here" style='width:100%; height:50%;'></div>
<div style="height: 100px;">
    <button onclick="sayStatus()">click here to show the open and $open status</button>
</div>
<textarea id="txt" rows="100" cols="200"></textarea>
    <script>
    gantt.init("gantt_here");

    let model = {
        tasks: [
            { id: 1, text: "Project A", type: "project", open: true },
            { id: 11, text: "Task #A1", start_date: "03-04-2023", duration: 5, parent: 1, open: true },
            { id: 12, text: "Task #A2", start_date: "03-04-2023", type: "project", parent: 1, open: true },
        ]
    };

    gantt.parse(model);
    function sayStatus() {
        let task = gantt.getTask(1);
        document.getElementById("txt").value += `The task is now open ${task.open} $open ${task.$open}.\n`;
    }

</script>


</body>

Hello Tom,
This is cannot be considered as a bug.

The open property is a property that is used in the taskConfig object that is loaded from the server. Gantt only uses that property when you load the data and doesn’t use it later:
https://docs.dhtmlx.com/gantt/desktop__task_properties.html#:~:text=Specifies%20whether%20the%20task%20branch%20will%20be%20opened%20initially%20(to%20show%20child%20tasks).%20To%20close/open%20the%20branch%20after%20Gantt%20initialization%2C%20use%20the%20related%20methods%3A%20close()%20and%20open()

The $open is an internal property that is used in the task object in Gantt:
Task Properties Gantt Docs.

As it is an internal property, Gantt doesn’t include it in the data sent to the server.
If you want to synchronize that property, you need to do that manually.

But if you want, I can ask the dev team if this should be added as a feature request.