@@ -86,7 +86,7 @@ SPDX-License-Identifier: AGPL-3.0-only
8686 </div >
8787 </section >
8888 </div >
89- <div v-once class =" group" >
89+ <div v-memo = " [customEmojiFolderRoot] " class =" group" >
9090 <header class =" _acrylic" >{{ i18n.ts.customEmojis }}</header >
9191 <XSection
9292 v-for =" child in customEmojiFolderRoot .children "
@@ -189,8 +189,6 @@ const searchResultCustom = ref<Misskey.entities.EmojiSimple[]>([]);
189189const searchResultUnicode = ref <UnicodeEmojiDef []>([]);
190190const tab = ref <' index' | ' custom' | ' unicode' | ' tags' >(' index' );
191191
192- const customEmojiFolderRoot: CustomEmojiFolderTree = { value: ' ' , category: ' ' , children: [] };
193-
194192function parseAndMergeCategories(input : string , root : CustomEmojiFolderTree ): CustomEmojiFolderTree {
195193 const parts = input .split (' /' ).map (p => p .trim ());
196194 let currentNode: CustomEmojiFolderTree = root ;
@@ -210,13 +208,19 @@ function parseAndMergeCategories(input: string, root: CustomEmojiFolderTree): Cu
210208 return currentNode ;
211209}
212210
213- customEmojiCategories .value .forEach (ec => {
214- if (ec !== null ) {
215- parseAndMergeCategories (ec , customEmojiFolderRoot );
216- }
217- });
211+ const customEmojiFolderRoot = computed (() => {
212+ const root: CustomEmojiFolderTree = { value: ' ' , category: ' ' , children: [] };
218213
219- parseAndMergeCategories (' ' , customEmojiFolderRoot );
214+ customEmojiCategories .value .forEach (ec => {
215+ if (ec !== null ) {
216+ parseAndMergeCategories (ec , root );
217+ }
218+ });
219+
220+ parseAndMergeCategories (' ' , root );
221+
222+ return root ;
223+ });
220224
221225watch (q , () => {
222226 if (emojisEl .value ) emojisEl .value .scrollTop = 0 ;
@@ -257,8 +261,9 @@ watch(q, () => {
257261 }
258262 }
259263 } else {
260- if (customEmojisMap .has (newQ )) {
261- matches .add (customEmojisMap .get (newQ )! );
264+ const exactMatch = customEmojisMap .value .get (newQ );
265+ if (exactMatch != null ) {
266+ matches .add (exactMatch );
262267 }
263268 if (matches .size >= max ) return matches ;
264269
@@ -405,7 +410,7 @@ function getDef(emoji: string): string | Misskey.entities.EmojiSimple | UnicodeE
405410 // カスタム絵文字が存在する場合はその情報を持つオブジェクトを返し、
406411 // サーバの管理画面から削除された等で情報が見つからない場合は名前の文字列をそのまま返しておく(undefinedを返すとエラーになるため)
407412 const name = emoji .replaceAll (' :' , ' ' );
408- return customEmojisMap .get (name ) ?? emoji ;
413+ return customEmojisMap .value . get (name ) ?? emoji ;
409414 } else {
410415 return getUnicodeEmoji (emoji );
411416 }
@@ -476,7 +481,7 @@ function done(query?: string): boolean | void {
476481 if (query == null || typeof query !== ' string' ) return ;
477482
478483 const q2 = query .replace (/ :/ g , ' ' );
479- const exactMatchCustom = customEmojisMap .get (q2 );
484+ const exactMatchCustom = customEmojisMap .value . get (q2 );
480485 if (exactMatchCustom ) {
481486 chosen (exactMatchCustom );
482487 return true ;
0 commit comments