@@ -125,56 +125,31 @@ async function toggleReaction() {
125125 if (! canToggle .value ) return ;
126126 if (! props .note ) return ; // Guard against undefined note
127127
128- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
129- const oldReaction = props .note .myReactions ?.includes (props .reaction )
130- ? props .reaction
131- : null ;
132- if (oldReaction ) {
128+ // Check if already reacted using the same logic as isReacted
129+ const alreadyReacted = props .note .myReactions ?.includes (props .reaction ) ?? false ;
130+
131+ if (alreadyReacted ) {
133132 const confirm = await os .confirm ({
134133 type: ' warning' ,
135- text:
136- oldReaction !== props .reaction
137- ? i18n .ts .changeReactionConfirm
138- : i18n .ts .cancelReactionConfirm ,
134+ text: i18n .ts .cancelReactionConfirm ,
139135 });
140136 if (confirm .canceled ) return ;
141137
142- // eslint-disable-next-line vue/no-mutating-props
143- props .note .myReactions .splice (
144- props .note .myReactions .indexOf (oldReaction ),
145- 1 ,
146- );
147- if (oldReaction !== props .reaction ) {
148- sound .playMisskeySfx (' reaction' );
149- }
150-
151138 if (mock ) {
152139 emit (' reactionToggled' , props .reaction , props .count - 1 );
153140 return ;
154141 }
155142
143+ // Note: The myReactions array will be updated by the noteEvents handler in use-note-capture.ts
144+
156145 misskeyApi (' notes/reactions/delete' , {
157146 noteId: props .noteId ,
158- reaction: oldReaction ,
147+ reaction: props . reaction ,
159148 }).then (() => {
160149 noteEvents .emit (` unreacted:${props .noteId } ` , {
161150 userId: $i ! .id ,
162- reaction: oldReaction ,
151+ reaction: props . reaction ,
163152 });
164- if (
165- oldReaction !== props .reaction
166- ) {
167- misskeyApi (' notes/reactions/create' , {
168- noteId: props .noteId ,
169- reaction: props .reaction ,
170- }).then (() => {
171- noteEvents .emit (` reacted:${props .noteId } ` , {
172- userId: $i ! .id ,
173- reaction: props .reaction ,
174- emoji: emoji .value ,
175- });
176- });
177- }
178153 });
179154 } else {
180155 if (prefer .s .confirmOnReact ) {
@@ -193,6 +168,7 @@ async function toggleReaction() {
193168 return ;
194169 }
195170
171+ // Note: The myReactions array will be updated by the noteEvents handler in use-note-capture.ts
196172 misskeyApi (' notes/reactions/create' , {
197173 noteId: props .noteId ,
198174 reaction: props .reaction ,
0 commit comments