Gantt.init is invalid

When re-rendering data,Gantt will display the last loaded data.

Hello,
Unfortunately, it is hard to suggest what might be the cause, because there can be a lot of reasons that may affect Gantt behaviour.
I need a sample of your code to see what might be wrong and I’ll try to reproduce it locally. You can modify the following snippet:
snippet.dhtmlx.com/b3e34d9d5
After you edit the code and see that it reproduces the error, click on the “Share” button and copy the link for the snippet.

This situation is not very reproducible,I use vue. I am on another page click on a different button and get a different id and there will be different data depending on the id。Then i use gantt.init(this.$refs.gantt); gantt.parse(_this.$props.tasks);
This is part of the code snippet:

gantt.init(this.$refs.gantt);
        gantt.parse(_this.$props.tasks);
        let params = new URLSearchParams();
        let orderId = window.localStorage.getItem('orderId');
        params.append('orderId', JSON.parse(orderId));
        this.$axios.post('/api/proPlan/groupPlanTree', params, {emulateJSON: true})
          .then((res) => {
            if (res.data.status === true) {
              let data = res.data.model;
              // let taskData = {};
              let links = [];
              for (const i in data) {
                if (data[i].id === null) {
                  data[i].id = 1234567;
                }
                if (data[i].parent === '0') {
                  data[i].type = 'project';
                }
                data.find(function (item, index) {
                  if (item.parent === data[i].parent && item.id !== data[i].id) {
                    data[i].linksparent = item.id;
                  } else {
                    data[i].linksparent = '';
                  }
                });
                // // data[i].id = data[i].id + '_' + i;
                if (data[i].startTime === null) {
                  let startDate = new Date();
                  data[i].start_date = startDate;
                } else {
                  let startDate = new Date(data[i].startTime);
                  data[i].start_date = startDate;
                }
                data[i].duration = 5;
                let linksData = {
                  id: data[i].id,
                  source: data[i].id,
                  target: data[i].parent,
                  type: '0',
                  lag: 0
                };
                links.push(linksData);
              }
              let taskData = {
                data: data,
                links: links
              };
              this.tasks = taskData;
              gantt.parse(taskData);
            }
          })
          .catch(() => {
            this.$message.error('服务器暂时无法连接,请稍后再试');
          });

This is the data I got three times.






Hello,
If I understand you correctly, when you load more data, previous data remain. Is that correct? If yes, then it is expected behaviour. When you load more data and there is a task with the same ID as another task, the existing task will be replaced. If there is no such a task, it will be added to existing tasks. To avoid that, before loading new data you can clear all existing data:
docs.dhtmlx.com/gantt/api__gantt_clearall.html
In the following snippet you can see how it works. If you click on the “load more data” button, new tasks will be added to the existing tasks. But if you click on the “Load only new data” button, only new tasks will remain in the chart.