From f55e9d7c321e4ecb46bd2acc23621cc96e5f427b Mon Sep 17 00:00:00 2001 From: jorgep Date: Mon, 3 Jun 2024 14:20:46 +0200 Subject: [PATCH] fix: refs #6891 Optimize RightMenu component rendering --- src/components/common/RightMenu.vue | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/common/RightMenu.vue b/src/components/common/RightMenu.vue index a288c7e80..f0a95b0df 100644 --- a/src/components/common/RightMenu.vue +++ b/src/components/common/RightMenu.vue @@ -9,19 +9,18 @@ const rightPanel = ref(null); onMounted(() => { rightPanel.value = document.querySelector('#right-panel'); - if (rightPanel.value.childNodes.length) hasContent.value = true; + if (!rightPanel.value) return; // Check if there's content to display const observer = new MutationObserver(() => { hasContent.value = rightPanel.value.childNodes.length; }); - if (rightPanel.value) - observer.observe(rightPanel.value, { - subtree: true, - childList: true, - attributes: true, - }); + observer.observe(rightPanel.value, { + subtree: true, + childList: true, + attributes: true, + }); if (!slots['right-panel'] && !hasContent.value) stateStore.rightDrawer = false; });