From e377b89740892cd86ce6ab287f41ed8b443de1a4 Mon Sep 17 00:00:00 2001 From: Matt Burnett Date: Tue, 1 Oct 2024 11:10:09 +0200 Subject: [PATCH] Bug: 980. Added if statement to watch(route) so that closeModal() is called only when modals are present. --- frontend/components/modal/ModalBase.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/components/modal/ModalBase.vue b/frontend/components/modal/ModalBase.vue index 3254a17d7..1a11f0cae 100644 --- a/frontend/components/modal/ModalBase.vue +++ b/frontend/components/modal/ModalBase.vue @@ -96,8 +96,11 @@ const closeModal = () => { modals.closeModal(modalName); }; -// If the user changes the route while the modal is open, close the modal. +// Check if the user is navigating to another resource. +// If a modal exists, close close it. watch(route, () => { - closeModal(); + if (modals.modals[modalName]) { + closeModal(); + } });