fix: 🐛 Fix emoji categories having an incorrect max-height on initial load

This commit is contained in:
Jesse Wierzbinski 2024-11-19 11:14:10 +01:00
parent 7663767141
commit 626828ffa4
No known key found for this signature in database

View file

@ -32,19 +32,15 @@ defineProps<{
const collapsed = ref(false); const collapsed = ref(false);
const container = ref<HTMLDivElement | null>(null); const container = ref<HTMLDivElement | null>(null);
watch( watch(collapsed, (value) => {
collapsed, // Use requestAnimationFrame to prevent layout thrashing
(value) => { requestAnimationFrame(() => {
// Use requestAnimationFrame to prevent layout thrashing if (!container.value) {
requestAnimationFrame(() => { return;
if (!container.value) { }
return; container.value.style.maxHeight = value
} ? "0px"
container.value.style.maxHeight = value : `${container.value.scrollHeight}px`;
? "0px" });
: `${container.value.scrollHeight}px`; });
});
},
{ immediate: true },
);
</script> </script>