In Gantt, I’ve noticed that when I delete a task, some other tasks are added to taskStore.changes.modified with a change in the parentIndex field—likely due to internal adjustments made by the engine.
Is there a recommended way to ignore these automatic modifications to parentIndex?
I’ve attached a small demo project where this behavior can be reproduced.
The automatic modifications to the parentIndex field are part of the internal logic to maintain the correct order of tasks within their parent after a deletion. Unfortunately, there isn't a direct way to ignore these changes as they are essential for keeping the tree structure consistent.
However, you can handle these changes by filtering them out when processing the taskStore.changes.modified array. You can check if the only change is in the parentIndex field and decide to ignore it in your application logic.
Here's a simple example of how you might filter out these changes:
const changes = taskStore.changes.modified.filter(change => {
// Ignore changes where only parentIndex is modified
return Object.keys(change).length > 1 || !change.hasOwnProperty('parentIndex');
});
// Process the filtered changes
console.log(changes);
This way, you can ensure that only significant changes are processed further in your application.