dataprocessor always saving all tasks

I’m running into an issue with the dataprocessor and the gantt, where every single task is being updated. I’m trying to use the REST transaction mode but have noticed the behaviour when I don’t specify a transaction mode.

Essentially, when I initialise the dataprocessor for the gantt, it immediately attempts to save every task that has been loaded which is pointless given that on page load, the tasks are already up to date. This appears to be happening regardless of whether I change the transaction mode.

When I change the transaction mode to REST however, this behaviour continues when I make any change to an individual task. Every single one is updated. I realise there is a setting for this when changing the transaction mode but I’m already setting this. My code looks like this:

    var url = '/projects/1/gantt_charts';

    gantt.init(container);
    gantt.load(url, 'json');

    var dp = new gantt.dataProcessor(url);
    dp.init(gantt);
    dp.setTransactionMode('REST', false);
    dp.enablePartialDataSend(true);
    dp.enableUTFencoding(true);

Everything here is what I’ve gathered from the documentation so I’m not sure what has gone wrong. Any help would be appreciated.

For anyone else who comes across this, it seems that the dataprocessor must be initialised AFTER the gantt has finished loading everything. Changing the initialisation to the following seems to resolve the issues:

var url = '/projects/1/gantt_charts';

gantt.init(container);
gantt.load(url, 'json', function() {
      var dp = new gantt.dataProcessor(url);
      dp.init(gantt);
      dp.setTransactionMode('REST', false);
      dp.enablePartialDataSend(true);
      dp.enableUTFencoding(true);
});