dynamically load audio visualizer
All checks were successful
Test (production install and build) / production (22.x) (pull_request) Successful in 3m5s
Lint / lint (frontend) (pull_request) Successful in 9m25s
Lint / lint (misskey-js) (pull_request) Successful in 2m12s
Lint / lint (sw) (pull_request) Successful in 2m30s
Lint / typecheck (backend) (pull_request) Successful in 2m59s
Lint / pnpm_install (pull_request) Successful in 2m15s
Test (frontend) / vitest (22.x) (pull_request) Successful in 2m57s
Lint / lint (backend) (pull_request) Successful in 2m56s
Lint / typecheck (misskey-js) (pull_request) Successful in 2m31s

audio visualizer weights 475 kB by itself, and audio files are
relatively rare on timelines, so it makes sense to load it only when
it's necessary
This commit is contained in:
sugar 2025-01-17 14:36:01 +01:00
parent b279f6e3d2
commit a8f604137c

View file

@ -79,7 +79,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { shallowRef, watch, computed, ref, onDeactivated, onActivated, onMounted } from 'vue';
import { shallowRef, watch, computed, ref, onDeactivated, onActivated, onMounted, defineAsyncComponent } from 'vue';
import * as Misskey from 'misskey-js';
import type { MenuItem } from '@/types/menu.js';
import { defaultStore } from '@/store.js';
@ -87,11 +87,11 @@ import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import bytes from '@/filters/bytes.js';
import { hms } from '@/filters/hms.js';
import MkAudioVisualizer from '@/components/MkAudioVisualizer.vue';
import MkMediaRange from '@/components/MkMediaRange.vue';
import { pleaseLogin } from '@/scripts/please-login.js';
import { $i, iAmModerator } from '@/account.js';
const MkAudioVisualizer = defineAsyncComponent(() => import('@/components/MkAudioVisualizer.vue'));
const props = defineProps<{
audio: Misskey.entities.DriveFile;
user?: Misskey.entities.UserLite;