This commit is contained in:
tamaina 2023-08-07 01:44:22 +00:00
parent 366dce1758
commit 70b363f4c3
1 changed files with 9 additions and 5 deletions

View File

@ -207,6 +207,15 @@ export class NoteManager {
executeInterruptor: () => Promise<void>, executeInterruptor: () => Promise<void>,
} { } {
const note = this.get(id); const note = this.get(id);
if (noteViewInterruptors.length === 0) {
// noteViewInterruptorがない場合はcomputed noteを直接渡す
return {
interruptedNote: note as InterruptedCachedNote,
interruptorUnwatch: () => { },
executeInterruptor: () => Promise.resolve(),
};
}
const interruptedNote = ref<Note | null>(note.value); const interruptedNote = ref<Note | null>(note.value);
async function executeInterruptor() { async function executeInterruptor() {
@ -215,11 +224,6 @@ export class NoteManager {
return; return;
} }
if (noteViewInterruptors.length === 0) {
interruptedNote.value = note.value;
return;
}
let result = deepClone(note.value); let result = deepClone(note.value);
for (const interruptor of noteViewInterruptors) { for (const interruptor of noteViewInterruptors) {
result = await interruptor.handler(result) as Note; result = await interruptor.handler(result) as Note;