From 5806356b9d8015dd9e15d463914353b43a1cf578 Mon Sep 17 00:00:00 2001 From: Pedro Dinis Date: Sat, 31 Aug 2024 23:07:13 +0100 Subject: [PATCH] Fixed issue with accordions not appearing open --- .../DocumentAnnotations/AnnotationFilters.vue | 2 +- .../DocumentAnnotations/DocumentAnnotations.vue | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/DocumentAnnotations/AnnotationFilters.vue b/src/components/DocumentAnnotations/AnnotationFilters.vue index 414f21bb..ea09c0d4 100644 --- a/src/components/DocumentAnnotations/AnnotationFilters.vue +++ b/src/components/DocumentAnnotations/AnnotationFilters.vue @@ -45,7 +45,7 @@ export default { watch: { search() { - if (this.search != "") { + if (this.search.length > 0) { this.$emit("openAll"); } if (this.search != this.annotationSearch) { diff --git a/src/components/DocumentAnnotations/DocumentAnnotations.vue b/src/components/DocumentAnnotations/DocumentAnnotations.vue index f3337ec3..e510392f 100644 --- a/src/components/DocumentAnnotations/DocumentAnnotations.vue +++ b/src/components/DocumentAnnotations/DocumentAnnotations.vue @@ -257,6 +257,12 @@ export default { oldAnnotationSets ); }, + getAnnotationsFiltered(newFiltered, oldFiltered) { + this.loadAccordions( + newFiltered.annotationSets, + oldFiltered.annotationSets + ); + }, annotationId(newAnnotationId) { if (newAnnotationId) { const annotationSet = this.annotationSetOfAnnotation(newAnnotationId); @@ -319,11 +325,13 @@ export default { newAnnotationSets.forEach((newAnnotationSet) => { const existed = oldAnnotationSets.find( (oldAnnotationSet) => + oldAnnotationSet && + newAnnotationSet && oldAnnotationSet.id && newAnnotationSet.id && oldAnnotationSet.id === newAnnotationSet.id ); - if (!existed && newAnnotationSet.id !== null) { + if (!existed && newAnnotationSet && newAnnotationSet.id !== null) { annotationSetsCreated.push(newAnnotationSet); } }); @@ -332,6 +340,7 @@ export default { newAnnotationSets.forEach((newAnnotationSet, index) => { const wasOpen = annotationSetsOpened.find( (annotationSetOpened) => + annotationSetOpened && annotationSetOpened.id && newAnnotationSet.id && newAnnotationSet.id === annotationSetOpened.id