From ea71118e5ad0fad916eac1eef10b1a1edbfe4f9e Mon Sep 17 00:00:00 2001 From: Richard Doe Date: Thu, 21 Nov 2024 12:38:45 +0000 Subject: [PATCH] refactor: scroll to annotation when set from route query --- .../portal/src/components/media/MediaAnnotationList.vue | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/portal/src/components/media/MediaAnnotationList.vue b/packages/portal/src/components/media/MediaAnnotationList.vue index c6c1c7f78a..dbd1f8c6db 100644 --- a/packages/portal/src/components/media/MediaAnnotationList.vue +++ b/packages/portal/src/components/media/MediaAnnotationList.vue @@ -132,9 +132,6 @@ this.scrollActiveAnnotationToCentre(); } }, - '$fetchState.pending'(pending) { - !pending && this.scrollActiveAnnotationToCentre(); - }, // TODO: should this watcher go into useItemMediaPresentation? annotationUri() { !this.searching && this.$fetch(); @@ -186,8 +183,10 @@ if (this.$route.query.anno !== this.activeAnnotation?.id) { const activeAnnotation = this.annotations.find((anno) => anno.id === this.$route.query.anno) || this.annotationSearchResults.find((anno) => anno.id === this.$route.query.anno); this.setActiveAnnotation(activeAnnotation || null); - process.client && this.scrollActiveAnnotationToCentre('instant'); } + this.$nextTick(() => { + process.client && this.scrollActiveAnnotationToCentre('instant'); + }); } } };