perf(frontend): サーバーにカスタム絵文字の種類が多い場合のパフォーマンスの改善

Resolve #10925
This commit is contained in:
syuilo 2023-05-31 12:42:24 +09:00
parent 14da0a65f7
commit 821bb1c476
4 changed files with 14 additions and 5 deletions

View file

@ -7,7 +7,7 @@
import { computed } from 'vue';
import { getProxiedImageUrl, getStaticImageUrl } from '@/scripts/media-proxy';
import { defaultStore } from '@/store';
import { customEmojis } from '@/custom-emojis';
import { customEmojisMap } from '@/custom-emojis';
const props = defineProps<{
name: string;
@ -26,7 +26,7 @@ const rawUrl = computed(() => {
return props.url;
}
if (isLocal.value) {
return customEmojis.value.find(x => x.name === customEmojiName.value)?.url ?? null;
return customEmojisMap.get(customEmojiName.value)?.url ?? null;
}
return props.host ? `/emoji/${customEmojiName.value}@${props.host}.webp` : `/emoji/${customEmojiName.value}.webp`;
});