fix
This commit is contained in:
parent
f6c2fae089
commit
be2e596027
|
@ -473,7 +473,8 @@ function showReactions(): void {
|
|||
}
|
||||
|
||||
const unuse = ref<() => void>();
|
||||
unuse.value = noteManager.useNote(props.note.id, true).unuse;
|
||||
|
||||
unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
|
||||
|
||||
onMounted(() => {
|
||||
executeInterruptor();
|
||||
|
@ -488,19 +489,20 @@ onUnmounted(() => {
|
|||
});
|
||||
|
||||
onActivated(() => {
|
||||
if (!unuse.value) {
|
||||
unuse.value = noteManager.useNote(props.note.id, true).unuse;
|
||||
if (!unuse.value && appearNote.value) {
|
||||
unuse.value = noteManager.useNote(appearNote.value?.id ?? props.note.id, true).unuse;
|
||||
}
|
||||
});
|
||||
|
||||
onDeactivated(() => {
|
||||
const _unuse = unuse.value;
|
||||
unuse.value = undefined;
|
||||
// 不要なキャッシュ消去や通信を防止するため遅延させる
|
||||
setTimeout(() => {
|
||||
if (unuse.value) {
|
||||
unuse.value();
|
||||
unuse.value = undefined;
|
||||
}
|
||||
}, 1000);
|
||||
if (_unuse) {
|
||||
setTimeout(() => {
|
||||
_unuse();
|
||||
}, 1000);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ function blur() {
|
|||
el.value?.blur();
|
||||
}
|
||||
|
||||
const { note: fetching, unuse } = noteManager.useNote(props.note.id, true);
|
||||
const { note: fetching, unuse } = noteManager.useNote(appearNote.value?.id ?? props.note.id, true);
|
||||
|
||||
onMounted(async () => {
|
||||
await fetching;
|
||||
|
|
|
@ -47,6 +47,14 @@ type CachedNoteSource = Ref<OmittedNote | null>;
|
|||
type CachedNote = ComputedRef<Note | null>;
|
||||
type InterruptedCachedNote = Ref<Note | null>;
|
||||
|
||||
export function isRenote(note: Note | OmittedNote): boolean {
|
||||
return note != null &&
|
||||
note.renoteId != null &&
|
||||
note.text == null &&
|
||||
note.fileIds?.length === 0 &&
|
||||
note.poll == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* ノートのキャッシュを管理する
|
||||
* 基本的な使い方:
|
||||
|
@ -197,14 +205,7 @@ export class NoteManager {
|
|||
*/
|
||||
public getNoteViewBase(id: string) {
|
||||
const { interruptedNote: note, interruptorUnwatch, executeInterruptor } = this.getInterrupted(id);
|
||||
//const note = this.get(id);
|
||||
const isRenote = computed(() => (
|
||||
note.value != null &&
|
||||
note.value.renote != null &&
|
||||
note.value.text == null &&
|
||||
note.value.fileIds?.length === 0 &&
|
||||
note.value.poll == null
|
||||
));
|
||||
const isRenote = computed(() => isRenote(note.value));
|
||||
const isMyRenote = computed(() => $i && ($i.id === note.value?.userId));
|
||||
const appearNote = computed(() => (isRenote.value ? note.value?.renote : note.value) ?? null);
|
||||
|
||||
|
|
Loading…
Reference in New Issue