attachment optimization

This commit is contained in:
Henry Jameson 2026-06-02 19:26:47 +03:00
commit 7686c42748
2 changed files with 12 additions and 9 deletions

View file

@ -1,7 +1,7 @@
import { mapState } from 'pinia' import { mapState } from 'pinia'
import { defineAsyncComponent } from 'vue'
import nsfwImage from '../../assets/nsfw.png' import nsfwImage from '../../assets/nsfw.png'
import Flash from '../flash/flash.vue'
import Popover from '../popover/popover.vue' import Popover from '../popover/popover.vue'
import StillImage from '../still-image/still-image.vue' import StillImage from '../still-image/still-image.vue'
import VideoAttachment from '../video_attachment/video_attachment.vue' import VideoAttachment from '../video_attachment/video_attachment.vue'
@ -69,9 +69,13 @@ const Attachment = {
} }
}, },
components: { components: {
Flash, Flash: defineAsyncComponent(
() => import( 'src/components/flash/flash.vue'),
),
StillImage, StillImage,
VideoAttachment, VideoAttachment: defineAsyncComponent(
() => import( 'src/components/video_attachment/video_attachment.vue'),
),
Popover, Popover,
}, },
computed: { computed: {

View file

@ -3,6 +3,9 @@ import GestureService from '../../services/gesture_service/gesture_service'
import { useMediaViewerStore } from 'src/stores/media_viewer.js' import { useMediaViewerStore } from 'src/stores/media_viewer.js'
import { defineAsyncComponent } from 'vue' import { defineAsyncComponent } from 'vue'
import Modal from 'src/components/modal/modal.vue'
import StillImage from 'src/components/still-image/still-image.vue'
import { library } from '@fortawesome/fontawesome-svg-core' import { library } from '@fortawesome/fontawesome-svg-core'
import { import {
faChevronLeft, faChevronLeft,
@ -15,9 +18,7 @@ library.add(faChevronLeft, faChevronRight, faCircleNotch, faTimes)
const MediaModal = { const MediaModal = {
components: { components: {
StillImage: defineAsyncComponent( StillImage,
() => import( 'src/components/still-image/still-image.vue'),
),
VideoAttachment: defineAsyncComponent( VideoAttachment: defineAsyncComponent(
() => import( 'src/components/video_attachment/video_attachment.vue'), () => import( 'src/components/video_attachment/video_attachment.vue'),
), ),
@ -27,9 +28,7 @@ const MediaModal = {
SwipeClick: defineAsyncComponent( SwipeClick: defineAsyncComponent(
() => import( 'src/components/swipe_click/swipe_click.vue'), () => import( 'src/components/swipe_click/swipe_click.vue'),
), ),
Modal: defineAsyncComponent( Modal,
() => import( 'src/components/modal/modal.vue'),
),
Flash: defineAsyncComponent( Flash: defineAsyncComponent(
() => import( 'src/components/flash/flash.vue'), () => import( 'src/components/flash/flash.vue'),
), ),