From 75ee2fb1a7e5a3f40a7dc1c9777f95db86b81e09 Mon Sep 17 00:00:00 2001 From: Hazelnoot Date: Thu, 23 Oct 2025 01:54:36 -0400 Subject: [PATCH] make emoji tags reactive --- packages/frontend/src/custom-emojis.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/frontend/src/custom-emojis.ts b/packages/frontend/src/custom-emojis.ts index 45d4b40fd7..6c22ab8bdb 100644 --- a/packages/frontend/src/custom-emojis.ts +++ b/packages/frontend/src/custom-emojis.ts @@ -10,6 +10,15 @@ import { get, set } from '@/utility/idb-proxy.js'; const storageCache = await get('emojis'); export const customEmojis = shallowRef(Array.isArray(storageCache) ? storageCache : []); +export const customEmojiTags = computed(() => { + const tags = new Set(); + for (const emoji of customEmojis.value) { + for (const tag of emoji.aliases) { + tags.add(tag); + } + } + return Array.from(tags); +}); export const customEmojiCategories = computed<[ ...string[], null ]>(() => { const categories = new Set(); for (const emoji of customEmojis.value) { @@ -60,17 +69,6 @@ export async function fetchCustomEmojis(force = false) { set('lastEmojisFetchedAt', now); } -let cachedTags; export function getCustomEmojiTags() { - if (cachedTags) return cachedTags; - - const tags = new Set(); - for (const emoji of customEmojis.value) { - for (const tag of emoji.aliases) { - tags.add(tag); - } - } - const res = Array.from(tags); - cachedTags = res; - return res; + return customEmojiTags.value; }