This commit is contained in:
tamaina 2023-08-06 12:46:13 +00:00
parent b73f88fe54
commit db15cab350
2 changed files with 4 additions and 4 deletions

View File

@ -493,7 +493,7 @@ onUnmounted(() => {
}); });
onActivated(() => { onActivated(() => {
if (!unuse.value && appearNote.value) { if (!unuse.value) {
unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse; unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
} }
}); });

View File

@ -373,9 +373,9 @@ export class NoteManager {
* *
* unuseすること * unuseすること
* @param id note id * @param id note id
* @returns { note, unuse } note: CachedNote | Promise<CachedNote>, unuse: () => void * @returns { note, unuse } note: CachedNote | Promise<CachedNote>, unuse: (noDeletion?: boolean) => void
*/ */
public useNote(id: string, shoudFetch: true): { note: Promise<CachedNote>, unuse: () => void }; public useNote(id: string, shoudFetch: true): { note: Promise<CachedNote>, unuse: (noDeletion?: boolean) => void };
public useNote(id: string, shoudFetch = false) { public useNote(id: string, shoudFetch = false) {
const note = (!this.notesSource.has(id) || shoudFetch) ? this.fetch(id) : this.get(id)!; const note = (!this.notesSource.has(id) || shoudFetch) ? this.fetch(id) : this.get(id)!;
let using = false; let using = false;
@ -389,7 +389,7 @@ export class NoteManager {
}); });
const unuse = (noDeletion = false) => { const unuse = (noDeletion = false) => {
CapturePromise.then(() => { CapturePromise.finally(() => {
if (!using) return; if (!using) return;
this.decapture(id, noDeletion); this.decapture(id, noDeletion);
using = false; using = false;