From 54addd0390565c14015755738af282276168b1d6 Mon Sep 17 00:00:00 2001 From: Lhc_fl Date: Mon, 21 Oct 2024 01:35:40 +0800 Subject: [PATCH 1/3] fix: fix type error of useNoteCapture --- packages/frontend/src/scripts/use-note-capture.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/scripts/use-note-capture.ts b/packages/frontend/src/scripts/use-note-capture.ts index 1b3626bff5..53eb6cf994 100644 --- a/packages/frontend/src/scripts/use-note-capture.ts +++ b/packages/frontend/src/scripts/use-note-capture.ts @@ -5,18 +5,18 @@ import { onUnmounted, Ref, ShallowRef } from 'vue'; import * as Misskey from 'misskey-js'; +import { misskeyApi } from './misskey-api.js'; import { useStream } from '@/stream.js'; import { $i } from '@/account.js'; import * as os from '@/os.js'; -import { misskeyApi } from './misskey-api.js'; export function useNoteCapture(props: { rootEl: ShallowRef; note: Ref; - pureNote: Ref; + pureNote?: Ref; isDeletedRef: Ref; - onReplyCallback: (replyNote: Misskey.entities.Note) => void | undefined; - onDeleteCallback: (id: Misskey.entities.Note['id']) => void | undefined; + onReplyCallback?: (replyNote: Misskey.entities.Note) => void | Promise; + onDeleteCallback?: (id: Misskey.entities.Note['id']) => void | Promise; }) { const note = props.note; const pureNote = props.pureNote !== undefined ? props.pureNote : props.note; @@ -39,7 +39,7 @@ export function useNoteCapture(props: { await props.onReplyCallback(replyNote); } catch { /* empty */ } - + break; } @@ -106,7 +106,7 @@ export function useNoteCapture(props: { const editedNote = await misskeyApi('notes/show', { noteId: id, }); - + const keys = new Set(); Object.keys(editedNote) .concat(Object.keys(note.value)) From 684be7d7094f44e22ca15d49963f33afdff6dfe2 Mon Sep 17 00:00:00 2001 From: Lhc_fl Date: Mon, 21 Oct 2024 01:38:03 +0800 Subject: [PATCH 2/3] fix: fix type error of useNoteCapture --- packages/frontend/src/scripts/use-note-capture.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/frontend/src/scripts/use-note-capture.ts b/packages/frontend/src/scripts/use-note-capture.ts index 53eb6cf994..3e2c046da2 100644 --- a/packages/frontend/src/scripts/use-note-capture.ts +++ b/packages/frontend/src/scripts/use-note-capture.ts @@ -22,7 +22,7 @@ export function useNoteCapture(props: { const pureNote = props.pureNote !== undefined ? props.pureNote : props.note; const connection = $i ? useStream() : null; - async function onStreamNoteUpdated(noteData): void { + async function onStreamNoteUpdated(noteData): Promise { const { type, id, body } = noteData; if ((id !== note.value.id) && (id !== pureNote.value.id)) return; @@ -81,7 +81,7 @@ export function useNoteCapture(props: { case 'pollVoted': { const choice = body.choice; - const choices = [...note.value.poll.choices]; + const choices = [...note.value.poll!.choices]; choices[choice] = { ...choices[choice], votes: choices[choice].votes + 1, @@ -90,7 +90,7 @@ export function useNoteCapture(props: { } : {}), }; - note.value.poll.choices = choices; + note.value.poll!.choices = choices; break; } From 5e4ed13213a6518c7ffae7082feeb3b2527696bf Mon Sep 17 00:00:00 2001 From: Lhc_fl Date: Mon, 21 Oct 2024 09:03:14 +0800 Subject: [PATCH 3/3] revert import sort --- packages/frontend/src/scripts/use-note-capture.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/use-note-capture.ts b/packages/frontend/src/scripts/use-note-capture.ts index 3e2c046da2..89aa023f23 100644 --- a/packages/frontend/src/scripts/use-note-capture.ts +++ b/packages/frontend/src/scripts/use-note-capture.ts @@ -5,10 +5,10 @@ import { onUnmounted, Ref, ShallowRef } from 'vue'; import * as Misskey from 'misskey-js'; -import { misskeyApi } from './misskey-api.js'; import { useStream } from '@/stream.js'; import { $i } from '@/account.js'; import * as os from '@/os.js'; +import { misskeyApi } from './misskey-api.js'; export function useNoteCapture(props: { rootEl: ShallowRef;