From 626828ffa46d7d915fdb346007ddbca6e74834ed Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Tue, 19 Nov 2024 11:14:10 +0100 Subject: [PATCH] fix: :bug: Fix emoji categories having an incorrect max-height on initial load --- components/settings/emojis/category.vue | 26 +++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/components/settings/emojis/category.vue b/components/settings/emojis/category.vue index dd7b0df..ec9c8ae 100644 --- a/components/settings/emojis/category.vue +++ b/components/settings/emojis/category.vue @@ -32,19 +32,15 @@ defineProps<{ const collapsed = ref(false); const container = ref(null); -watch( - collapsed, - (value) => { - // Use requestAnimationFrame to prevent layout thrashing - requestAnimationFrame(() => { - if (!container.value) { - return; - } - container.value.style.maxHeight = value - ? "0px" - : `${container.value.scrollHeight}px`; - }); - }, - { immediate: true }, -); +watch(collapsed, (value) => { + // Use requestAnimationFrame to prevent layout thrashing + requestAnimationFrame(() => { + if (!container.value) { + return; + } + container.value.style.maxHeight = value + ? "0px" + : `${container.value.scrollHeight}px`; + }); +}); \ No newline at end of file