From b3decdc4e5c34aa3b76d79855053a299897555eb Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 11 Feb 2022 21:35:28 +0900 Subject: fix(client): ノートの参照を断ち切るように MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix #8201 Close #8237 --- packages/client/src/components/note.vue | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'packages/client/src/components') diff --git a/packages/client/src/components/note.vue b/packages/client/src/components/note.vue index 6c596fb60d..7cf5fb0474 100644 --- a/packages/client/src/components/note.vue +++ b/packages/client/src/components/note.vue @@ -138,11 +138,13 @@ const props = defineProps<{ const inChannel = inject('inChannel', null); +const note = $ref(JSON.parse(JSON.stringify(props.note))); + const isRenote = ( - props.note.renote != null && - props.note.text == null && - props.note.fileIds.length === 0 && - props.note.poll == null + note.renote != null && + note.text == null && + note.fileIds.length === 0 && + note.poll == null ); const el = ref(); @@ -150,8 +152,8 @@ const menuButton = ref(); const renoteButton = ref>(); const renoteTime = ref(); const reactButton = ref(); -let appearNote = $ref(isRenote ? props.note.renote as misskey.entities.Note : props.note); -const isMyRenote = $i && ($i.id === props.note.userId); +let appearNote = $ref(isRenote ? note.renote as misskey.entities.Note : note); +const isMyRenote = $i && ($i.id === note.userId); const showContent = ref(false); const collapsed = ref(appearNote.cw == null && appearNote.text != null && ( (appearNote.text.split('\n').length > 9) || @@ -176,8 +178,9 @@ const keymap = { }; useNoteCapture({ - appearNote: $$(appearNote), rootEl: el, + note: $$(appearNote), + isDeletedRef: $$(isDeleted), }); function reply(viaKeyboard = false): void { @@ -225,12 +228,12 @@ function onContextmenu(ev: MouseEvent): void { ev.preventDefault(); react(); } else { - os.contextMenu(getNoteMenu({ note: props.note, translating, translation, menuButton }), ev).then(focus); + os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton }), ev).then(focus); } } function menu(viaKeyboard = false): void { - os.popupMenu(getNoteMenu({ note: props.note, translating, translation, menuButton }), menuButton.value, { + os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton }), menuButton.value, { viaKeyboard }).then(focus); } @@ -243,7 +246,7 @@ function showRenoteMenu(viaKeyboard = false): void { danger: true, action: () => { os.api('notes/delete', { - noteId: props.note.id + noteId: note.id }); isDeleted.value = true; } -- cgit v1.2.3-freya