From 683b4aafb2928f2d8dfa626352584542e3df8e3a Mon Sep 17 00:00:00 2001 From: dakkar Date: Tue, 19 Dec 2023 09:07:32 +0000 Subject: real-time updates on note detail view `useNoteCapture` already subscribes to all updates for a note, so we can tell it when a note gets replied to, too Since I'm not actually adding any extra subscription in the client, just an extra callback, there should be no overhead when replies are not coming in. Also, all the timelines already call `useNoteCapture` for each note displayed, so we know the whole `GlobalEventService` thing works fine. Many thanks to VueJS for taking care of all the DOM complications --- packages/frontend/src/components/MkNoteDetailed.vue | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'packages/frontend/src/components/MkNoteDetailed.vue') diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index f29b9db6ae..ae9d8a0d6b 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -372,11 +372,16 @@ const reactionsPagination = computed(() => ({ }, })); +async function addReplyTo(note, replyNote: Misskey.entities.Note) { + replies.value.unshift(replyNote); +} + useNoteCapture({ rootEl: el, note: appearNote, pureNote: note, isDeletedRef: isDeleted, + onReplyCallback: addReplyTo, }); useTooltip(renoteButton, async (showing) => { -- cgit v1.2.3-freya