refactor: dynamic imports for sidebar tab components

- Convert static imports to defineAsyncComponent

- Breaks ~100 circular dependency cycles through sidebar tabs

- Sidebar tabs load lazily on first access

Amp-Thread-ID: https://ampcode.com/threads/T-019bfe73-6a29-7638-8160-8de515af8707
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-01-27 00:37:18 -08:00
parent 440e25e232
commit 1bc7bb7544
4 changed files with 24 additions and 12 deletions

View File

@@ -1,10 +1,13 @@
import { markRaw } from 'vue'
import { defineAsyncComponent } from 'vue'
import ModelLibrarySidebarTab from '@/components/sidebar/tabs/ModelLibrarySidebarTab.vue'
import { useElectronDownloadStore } from '@/stores/electronDownloadStore'
import type { SidebarTabExtension } from '@/types/extensionTypes'
import { isElectron } from '@/utils/envUtil'
const ModelLibrarySidebarTab = defineAsyncComponent(
() => import('@/components/sidebar/tabs/ModelLibrarySidebarTab.vue')
)
export const useModelLibrarySidebarTab = (): SidebarTabExtension => {
return {
id: 'model-library',
@@ -12,7 +15,7 @@ export const useModelLibrarySidebarTab = (): SidebarTabExtension => {
title: 'sideToolbar.modelLibrary',
tooltip: 'sideToolbar.modelLibrary',
label: 'sideToolbar.labels.models',
component: markRaw(ModelLibrarySidebarTab),
component: ModelLibrarySidebarTab,
type: 'vue',
iconBadge: () => {
if (isElectron()) {