optimized skipRender

This commit is contained in:
fly_mc 2024-12-12 12:23:04 +08:00
parent 25ea4e5111
commit 779cf925f5

View file

@ -9,7 +9,8 @@ SPDX-License-Identifier: AGPL-3.0-only
v-show="!isDeleted"
ref="rootEl"
v-hotkey="keymap"
:class="[$style.root, { [$style.showActionsOnlyHover]: defaultStore.state.showNoteActionsOnlyHover, [$style.skipRender]: defaultStore.state.skipNoteRender || defaultStore.state.enableRenderingOptimization }]"
:data-note-id="note.id"
:class="[$style.root, { [$style.showActionsOnlyHover]: defaultStore.state.showNoteActionsOnlyHover, [$style.skipRender]: shouldSkipRender }]"
:tabindex="isDeleted ? '-1' : '0'"
>
<div v-show="collapsedUnexpectedLangs && isUnexpectedLanguage && !languageExpanded && !isRenote" :class="$style.collapsedLanguage">
@ -196,7 +197,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, inject, onMounted, ref, shallowRef, Ref, watch, provide } from 'vue';
import { computed, inject, nextTick, onMounted, ref, shallowRef, Ref, watch, provide } from 'vue';
import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js';
import { isLink } from '@@/js/is-link.js';
@ -268,6 +269,18 @@ const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', nul
const note = ref(deepClone(props.note));
const shouldSkipRender = ref(defaultStore.state.skipNoteRender || defaultStore.state.enableRenderingOptimization);
onMounted(() => {
if (shouldSkipRender.value) {
nextTick(() => {
setTimeout(() => {
shouldSkipRender.value = false;
}, 100);
});
}
});
// plugin
if (noteViewInterruptors.length > 0) {
onMounted(async () => {