From 5972d875161ba14a031afffd9bf7939d20d017e4 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sat, 28 May 2022 20:44:12 +0900 Subject: [PATCH] performance: Stop always load EmojiPicker and EmojiIndex --- src/renderer/components/atoms/FailoverImg.vue | 1 + src/renderer/components/organisms/Toot.vue | 61 ++++++++++++++----- 2 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/renderer/components/atoms/FailoverImg.vue b/src/renderer/components/atoms/FailoverImg.vue index 418fb911..cd3a26a0 100644 --- a/src/renderer/components/atoms/FailoverImg.vue +++ b/src/renderer/components/atoms/FailoverImg.vue @@ -7,6 +7,7 @@ v-on:load="loading = false" :class="loading ? 'loading' : ''" @click="$emit('click')" + loading="lazy" /> diff --git a/src/renderer/components/organisms/Toot.vue b/src/renderer/components/organisms/Toot.vue index 1b822136..3040400b 100644 --- a/src/renderer/components/organisms/Toot.vue +++ b/src/renderer/components/organisms/Toot.vue @@ -1,8 +1,8 @@ -
+
{{ $t('cards.toot.via', { application: application }) }}
@@ -250,6 +267,8 @@ import { ACTION_TYPES as MUTE_ACTION } from '@/store/TimelineSpace/Modals/MuteCo import { ACTION_TYPES as VIEWER_ACTION } from '@/store/TimelineSpace/Modals/ImageViewer' import { ACTION_TYPES } from '@/store/organisms/Toot' +const defaultEmojiIndex = new EmojiIndex(data) + export default defineComponent({ name: 'toot', components: { @@ -296,7 +315,8 @@ export default defineComponent({ const showContent = ref(store.state.App.ignoreCW) const showAttachments = ref(store.state.App.ignoreNSFW) const hideAllAttachments = ref(store.state.App.hideAllAttachments) - const emojiIndex = new EmojiIndex(data) + const emojiPickerOpened = ref(false) + const emojiIndex = defaultEmojiIndex const displayNameStyle = computed(() => store.state.App.displayNameStyle) const timeFormat = computed(() => store.state.App.timeFormat) @@ -600,6 +620,12 @@ export default defineComponent({ showAttachments.value = !showAttachments.value ctx.emit('sizeChanged', true) } + const emojiPickerShow = () => { + emojiPickerOpened.value = true + } + const emojiPickerHide = () => { + emojiPickerOpened.value = false + } return { emojiIndex, @@ -651,7 +677,10 @@ export default defineComponent({ removeReaction, openQuote, toggleSpoiler, - toggleCW + toggleCW, + emojiPickerOpened, + emojiPickerShow, + emojiPickerHide } } })