Need help with msg "Task not found id=#" after task created

Everything works ok, data is saved in database and it displays correctly.
BUT, once I insert new task and want to edit it it shows me red message “Task not found id=1520673344390”
If I click on some other tasks or refresh page then I can edit this new task.
It looks like gantt not refreshed automatically?

JS code:

[code][/code]

Response code after task insert:

{"action":"inserted","tid":39}

As you can see ID returns correctly. No any js errors in console.

Anyone have this issue? What I’m doing wrong?

found solution by adding “refreshData”

[code] dp.setTransactionMode(“POST”);

dp.attachEvent(“onAfterUpdate”, function(id, action, tid, response){
gantt.refreshData();
})[/code]

I had this problem as well. My problem was that the different frontend/backend tutorials have slightly different schemas/APIs.
I was mixing Angular 5 with PHP.

The PHP backend tutorial describes the JSON response from your comment:

{"action":"inserted","tid":39}

However the hook from the Angular frontend tutorial is expecting the “id” field to have the key “id” instead of “tid”:

    gantt.attachEvent('onAfterTaskAdd', (id, item) => {
      this.taskService.insert(this.serializeTask(item, true))
        .then((response) => {
          if (response.id !== id) {
            gantt.changeTaskId(id, response.id);
          }
        });
    });

Changing “response.id” to “response.tid” fixed it for me.

Your solution of “refreshData” also probably works, because I assume it fills in the missing ID from the normal GET response instead of parsing the POST response