From 2dfe5ac4f049ff31c81768bfa247b4ace71187c1 Mon Sep 17 00:00:00 2001 From: malkja Date: Tue, 16 Jul 2024 16:50:08 +0200 Subject: [PATCH] fix: remove error when annotations are null --- src/stores/annotations.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/stores/annotations.ts b/src/stores/annotations.ts index fbf69e9e..8a026748 100644 --- a/src/stores/annotations.ts +++ b/src/stores/annotations.ts @@ -99,7 +99,8 @@ export const useAnnotationsStore = defineStore('annotations', () => { }; - const addHighlightAttributesToText = (dom) => { + const addHighlightAttributesToText = (dom) => { + if (annotations.value !== null) { annotations.value.forEach((annotation) => { const { id } = annotation; const selector = Utils.generateTargetSelector(annotation); @@ -107,6 +108,7 @@ export const useAnnotationsStore = defineStore('annotations', () => { Utils.addHighlightToElements(selector, dom, id); } }); + } }; const annotationLoaded = (annotations) => {