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; }