diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 5272bf865..339d2ac71 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -232,6 +232,7 @@ const keymap = { useNoteCapture({ rootEl: el, note: $$(appearNote), + pureNote: $$(note), isDeletedRef: isDeleted, }); diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index a1360aba9..273984cc0 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -296,6 +296,7 @@ const reactionsPagination = $computed(() => ({ useNoteCapture({ rootEl: el, note: $$(appearNote), + pureNote: $$(note), isDeletedRef: isDeleted, }); diff --git a/packages/frontend/src/scripts/use-note-capture.ts b/packages/frontend/src/scripts/use-note-capture.ts index c61853257..bda9c04ea 100644 --- a/packages/frontend/src/scripts/use-note-capture.ts +++ b/packages/frontend/src/scripts/use-note-capture.ts @@ -11,15 +11,17 @@ import { $i } from '@/account.js'; export function useNoteCapture(props: { rootEl: Ref; note: Ref; + pureNote: Ref; isDeletedRef: Ref; }) { const note = props.note; + const pureNote = props.pureNote; const connection = $i ? useStream() : null; function onStreamNoteUpdated(noteData): void { const { type, id, body } = noteData; - if (id !== note.value.id) return; + if ((id !== note.value.id) && (id !== pureNote.value.id)) return; switch (type) { case 'reacted': { @@ -82,6 +84,7 @@ export function useNoteCapture(props: { if (connection) { // TODO: このノートがストリーミング経由で流れてきた場合のみ sr する connection.send(document.body.contains(props.rootEl.value) ? 'sr' : 's', { id: note.value.id }); + if (pureNote.value.id !== note.value.id) connection.send('s', { id: pureNote.value.id }); if (withHandler) connection.on('noteUpdated', onStreamNoteUpdated); } } @@ -91,6 +94,11 @@ export function useNoteCapture(props: { connection.send('un', { id: note.value.id, }); + if (pureNote.value.id !== note.value.id) { + connection.send('un', { + id: pureNote.value.id, + }); + } if (withHandler) connection.off('noteUpdated', onStreamNoteUpdated); } }