From 1598abba5107806fec70044ff7b8562822335613 Mon Sep 17 00:00:00 2001 From: Tom Najdek Date: Wed, 21 Aug 2024 11:55:15 +0200 Subject: [PATCH] Notify the reader about deleted annotations. Fix #561 --- src/js/component/reader.jsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/js/component/reader.jsx b/src/js/component/reader.jsx index 3625879b..e36718bc 100644 --- a/src/js/component/reader.jsx +++ b/src/js/component/reader.jsx @@ -491,7 +491,13 @@ const Reader = () => { }).filter(a => { return !deepEqual(a, prevAnnotations.find(pa => pa.key === a.key)) }); + + const deletedAnnotations = prevAnnotations + .filter(pa => !annotations.find(a => a.key === pa.key)) + .map(a => a.key); + reader.current.setAnnotations(getProcessedAnnotations(changedAnnotations)); + reader.current.unsetAnnotations(deletedAnnotations); } }, [annotations, getProcessedAnnotations, isBusy, prevAnnotations, state.importedAnnotations, state.isReady, wasBusy]);