diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2025-05-25 08:38:29 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-25 08:38:29 +0900 |
| commit | 0504d4399c6943beee12ac54addd042ef59e33e8 (patch) | |
| tree | f5cdf6b07ff66175d5e783b66a44cc2f61e29349 /packages/frontend/src | |
| parent | fix(frontend): タブ間同期が行われるとテーマが切り替わり... (diff) | |
| download | misskey-0504d4399c6943beee12ac54addd042ef59e33e8.tar.gz misskey-0504d4399c6943beee12ac54addd042ef59e33e8.tar.bz2 misskey-0504d4399c6943beee12ac54addd042ef59e33e8.zip | |
fix(frontend): リアクション削除イベントのコンディションが誤っていたのを修正 (#16097)
Diffstat (limited to 'packages/frontend/src')
| -rw-r--r-- | packages/frontend/src/composables/use-note-capture.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/frontend/src/composables/use-note-capture.ts b/packages/frontend/src/composables/use-note-capture.ts index a8f4a5a2a9..90a5922b3e 100644 --- a/packages/frontend/src/composables/use-note-capture.ts +++ b/packages/frontend/src/composables/use-note-capture.ts @@ -187,6 +187,8 @@ export type ReactiveNoteData = { pollChoices: NonNullable<Misskey.entities.Note['poll']>['choices']; }; +const noReaction = Symbol(); + export function useNoteCapture(props: { note: Misskey.entities.Note; parentNote: Misskey.entities.Note | null; @@ -219,7 +221,7 @@ export function useNoteCapture(props: { noteEvents.on(`pollVoted:${note.id}`, onPollVoted); // 操作がダブっていないかどうかを簡易的に記録するためのMap - const reactionUserMap = new Map<Misskey.entities.User['id'], string>(); + const reactionUserMap = new Map<Misskey.entities.User['id'], string | typeof noReaction>(); let latestPollVotedKey: string | null = null; function onReacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void { @@ -245,8 +247,9 @@ export function useNoteCapture(props: { function onUnreacted(ctx: { userId: Misskey.entities.User['id']; reaction: string; emoji?: { name: string; url: string; }; }): void { const normalizedName = ctx.reaction.replace(/^:(\w+):$/, ':$1@.:'); - if (!reactionUserMap.has(ctx.userId)) return; - reactionUserMap.delete(ctx.userId); + // 確実に一度リアクションされて取り消されている場合のみ処理をとめる(APIで初回読み込み→Streamでアップデート等の場合、reactionUserMapに情報がないため) + if (reactionUserMap.has(ctx.userId) && reactionUserMap.get(ctx.userId) === noReaction) return; + reactionUserMap.set(ctx.userId, noReaction); const currentCount = $note.reactions[normalizedName] || 0; |