support icon indicating copy to clipboard operation
support copied to clipboard

`addTask` method should behave similar to transactional features

Open bmblb opened this issue 1 year ago • 0 comments

Current implementation with auto recording STM may lead to a problem:

  1. task is added, stm is still auto recording
  2. sync request sent
  3. response received and being applied
  4. applyProjectChanges sees STM is recording and stashes the transaction moving phantom record away. method adds new task, then stash is applied and we get duplicate.

It should probably be wrapped to a queue step and STM should be forcefully stopped at the end of the method.

Workaround:

addTask(...args) {
    return this.project.queue(async () => {
        const record = await this._overridden.addTask.apply(this, args);
        if (this.project.stm.isRecording) {
            this.project.stm.stopTransaction();
        }
        return record;
    })
}

bmblb avatar Dec 07 '23 13:12 bmblb