diff --git a/src/modules/annotations/Annotations.js b/src/modules/annotations/Annotations.js index 98f1f0438..c206f596a 100644 --- a/src/modules/annotations/Annotations.js +++ b/src/modules/annotations/Annotations.js @@ -286,11 +286,14 @@ export default class Annotations { ) // annotations added externally should be cleared out too - w.globals.memory.methodsToExec.map((m, i) => { - if (m.label === 'addText' || m.label === 'addAnnotation') { + for (let i = w.globals.memory.methodsToExec.length - 1; i >= 0; i--) { + if ( + w.globals.memory.methodsToExec[i].label === 'addText' || + w.globals.memory.methodsToExec[i].label === 'addAnnotation' + ) { w.globals.memory.methodsToExec.splice(i, 1) } - }) + } annos = Utils.listToArray(annos)