mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 23:50:08 +00:00
- 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>
32 lines
983 B
TypeScript
32 lines
983 B
TypeScript
import { defineAsyncComponent } from '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',
|
|
icon: 'icon-[comfy--ai-model]',
|
|
title: 'sideToolbar.modelLibrary',
|
|
tooltip: 'sideToolbar.modelLibrary',
|
|
label: 'sideToolbar.labels.models',
|
|
component: ModelLibrarySidebarTab,
|
|
type: 'vue',
|
|
iconBadge: () => {
|
|
if (isElectron()) {
|
|
const electronDownloadStore = useElectronDownloadStore()
|
|
if (electronDownloadStore.inProgressDownloads.length > 0) {
|
|
return electronDownloadStore.inProgressDownloads.length.toString()
|
|
}
|
|
}
|
|
|
|
return null
|
|
}
|
|
}
|
|
}
|