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

@@ -1,4 +1,4 @@
import { shallowRef, computed, markRaw } from 'vue';
import { shallowRef, computed, markRaw, watch } from 'vue';
import * as Misskey from 'misskey-js';
import { api, apiGet } from './os';
import { useStream } from '@/stream';
@@ -16,6 +16,14 @@ export const customEmojiCategories = computed<[ ...string[], null ]>(() => {
return markRaw([...Array.from(categories), null]);
});
export const customEmojisMap = new Map<string, Misskey.entities.CustomEmoji>();
watch(customEmojis, emojis => {
customEmojisMap.clear();
for (const emoji of emojis) {
customEmojisMap.set(emoji.name, emoji);
}
}, { immediate: true });
// TODO: ここら辺副作用なのでいい感じにする
const stream = useStream();