@@ -37,7 +37,7 @@ import { getEmojiNameFromReaction, isLocalCustomEmojiReaction } from '@@/js/emoj
3737import XReaction from ' @/components/MkReactionsViewer.reaction.vue' ;
3838import { $i } from ' @/i.js' ;
3939import { prefer } from ' @/preferences.js' ;
40- import { customEmojisMap } from ' @/custom-emojis.js' ;
40+ import { customEmojis , customEmojisMap } from ' @/custom-emojis.js' ;
4141import { DI } from ' @/di.js' ;
4242
4343const props = withDefaults (defineProps <{
@@ -82,7 +82,9 @@ function canReact(reaction: string) {
8282 : isSupportedEmoji (reaction );
8383}
8484
85- watch ([() => props .reactions , () => props .maxNumber ], ([newSource , maxNumber ]) => {
85+ let lastCanReact: Map <string , boolean > | null = null ;
86+
87+ function rebuildReactions(newSource : Misskey .entities .Note [' reactions' ], maxNumber : number ) {
8688 let newReactions: [string , number ][] = [];
8789 hasMoreReactions .value = Object .keys (newSource ).length > maxNumber ;
8890
@@ -101,6 +103,7 @@ watch([() => props.reactions, () => props.maxNumber], ([newSource, maxNumber]) =
101103 for (const [emoji] of sorted ) {
102104 canReactCache .set (emoji , canReact (emoji ));
103105 }
106+ lastCanReact = canReactCache ;
104107 sorted .sort (([emojiA , countA ], [emojiB , countB ]) => {
105108 const canReactA = canReactCache .get (emojiA )! ;
106109 const canReactB = canReactCache .get (emojiB )! ;
@@ -124,7 +127,19 @@ watch([() => props.reactions, () => props.maxNumber], ([newSource, maxNumber]) =
124127 }
125128
126129 _reactions .value = newReactions ;
130+ }
131+
132+ watch ([() => props .reactions , () => props .maxNumber ], ([newSource , maxNumber ]) => {
133+ rebuildReactions (newSource , maxNumber );
127134}, { immediate: true , deep: true });
135+
136+ watch (customEmojis , () => {
137+ if (! prefer .s .showAvailableReactionsFirstInNote || lastCanReact == null ) return ;
138+ const sortedWith = lastCanReact ;
139+ if (! Object .keys (props .reactions ).some (r => sortedWith .has (r ) && sortedWith .get (r ) !== canReact (r ))) return ;
140+ _reactions .value = [];
141+ rebuildReactions (props .reactions , props .maxNumber );
142+ });
128143 </script >
129144
130145<style lang="scss" module>
0 commit comments