diff --git a/src/core/core_utils.js b/src/core/core_utils.js index 5980a51f2..85aedf03b 100644 --- a/src/core/core_utils.js +++ b/src/core/core_utils.js @@ -669,12 +669,7 @@ function getNewAnnotationsMap(annotationStorage) { if (!key.startsWith(AnnotationEditorPrefix)) { continue; } - let annotations = newAnnotationsByPage.get(value.pageIndex); - if (!annotations) { - annotations = []; - newAnnotationsByPage.set(value.pageIndex, annotations); - } - annotations.push(value); + newAnnotationsByPage.getOrInsert(value.pageIndex, []).push(value); } return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null; }