diff --git a/src/components/dialog/content/LoadWorkflowWarning.vue b/src/components/dialog/content/LoadWorkflowWarning.vue index 0c963fd39..3a38c339e 100644 --- a/src/components/dialog/content/LoadWorkflowWarning.vue +++ b/src/components/dialog/content/LoadWorkflowWarning.vue @@ -36,7 +36,6 @@ size="md" :disabled="!!error || missingNodePacks.length === 0" :is-loading="isLoading" - :is-installing="isInstalling" :node-packs="missingNodePacks" :label=" isLoading @@ -59,11 +58,9 @@ import PackInstallButton from '@/components/dialog/content/manager/button/PackIn import { useMissingNodes } from '@/composables/nodePack/useMissingNodes' import { useComfyManagerService } from '@/services/comfyManagerService' import { useDialogService } from '@/services/dialogService' -import { useComfyManagerStore } from '@/stores/comfyManagerStore' import type { MissingNodeType } from '@/types/comfy' import { ManagerTab } from '@/types/comfyManagerTypes' - const props = defineProps<{ missingNodeTypes: MissingNodeType[] }>() @@ -72,17 +69,8 @@ const props = defineProps<{ const { missingNodePacks, isLoading, error, missingCoreNodes } = useMissingNodes() -const comfyManagerStore = useComfyManagerStore() const isLegacyManager = ref(false) -// Check if any of the missing packs are currently being installed -const isInstalling = computed(() => { - if (!missingNodePacks.value?.length) return false - return missingNodePacks.value.some((pack) => - comfyManagerStore.isPackInstalling(pack.id) - ) -}) - const uniqueNodes = computed(() => { const seenTypes = new Set() return props.missingNodeTypes diff --git a/src/components/dialog/content/manager/button/PackEnableToggle.test.ts b/src/components/dialog/content/manager/button/PackEnableToggle.test.ts index 75d5babe5..4cef8883f 100644 --- a/src/components/dialog/content/manager/button/PackEnableToggle.test.ts +++ b/src/components/dialog/content/manager/button/PackEnableToggle.test.ts @@ -11,10 +11,14 @@ import { useComfyManagerStore } from '@/stores/comfyManagerStore' import PackEnableToggle from './PackEnableToggle.vue' -// Mock debounce to execute immediately -vi.mock('es-toolkit/compat', () => ({ - debounce: any>(fn: T) => fn -})) +// Mock debounce and memoize to execute immediately +vi.mock('es-toolkit/compat', async (importOriginal) => { + const actual = (await importOriginal()) as any + return { + ...actual, + debounce: any>(fn: T) => fn + } +}) const mockNodePack = { id: 'test-pack', diff --git a/src/components/dialog/content/manager/button/PackInstallButton.vue b/src/components/dialog/content/manager/button/PackInstallButton.vue index a18a59081..414e55f7f 100644 --- a/src/components/dialog/content/manager/button/PackInstallButton.vue +++ b/src/components/dialog/content/manager/button/PackInstallButton.vue @@ -47,7 +47,6 @@ type NodePack = components['schemas']['Node'] const { nodePacks, isLoading = false, - isInstalling = false, label = 'Install', size = 'sm', hasConflict, @@ -55,7 +54,6 @@ const { } = defineProps<{ nodePacks: NodePack[] isLoading?: boolean - isInstalling?: boolean label?: string size?: ButtonSize hasConflict?: boolean @@ -65,6 +63,12 @@ const { const managerStore = useComfyManagerStore() const { showNodeConflictDialog } = useDialogService() +// Check if any of the packs are currently being installed +const isInstalling = computed(() => { + if (!nodePacks?.length) return false + return nodePacks.some((pack) => managerStore.isPackInstalling(pack.id)) +}) + const createPayload = (installItem: NodePack) => { if (!installItem.id) { throw new Error('Node ID is required for installation') @@ -107,14 +111,12 @@ const installAllPacks = async () => { buttonText: t('manager.conflicts.installAnyway'), onButtonClick: async () => { // Proceed with installation - // isInstalling.value = true await performInstallation(nodePacks) } }) return } // No conflicts or conflicts acknowledged - proceed with installation - // isInstalling.value = true await performInstallation(nodePacks) } @@ -124,7 +126,7 @@ const performInstallation = async (packs: NodePack[]) => { } const computedLabel = computed(() => - isInstalling + isInstalling.value ? t('g.installing') : label ?? (nodePacks.length > 1 ? t('manager.installSelected') : t('g.install')) diff --git a/src/components/dialog/content/manager/infoPanel/InfoPanelHeader.vue b/src/components/dialog/content/manager/infoPanel/InfoPanelHeader.vue index 1e50b897d..4cf84ab63 100644 --- a/src/components/dialog/content/manager/infoPanel/InfoPanelHeader.vue +++ b/src/components/dialog/content/manager/infoPanel/InfoPanelHeader.vue @@ -26,7 +26,6 @@ v-else v-bind="$attrs" size="md" - :is-installing="isInstalling" :node-packs="nodePacks" :has-conflict="hasConflict" /> @@ -42,7 +41,7 @@ diff --git a/src/components/dialog/content/manager/infoPanel/InfoPanelMultiItem.vue b/src/components/dialog/content/manager/infoPanel/InfoPanelMultiItem.vue index cd08234f6..ece04696e 100644 --- a/src/components/dialog/content/manager/infoPanel/InfoPanelMultiItem.vue +++ b/src/components/dialog/content/manager/infoPanel/InfoPanelMultiItem.vue @@ -24,7 +24,6 @@ v-else v-bind="$attrs" size="md" - :is-installing="isInstalling" :node-packs="nodePacks" /> @@ -77,12 +76,6 @@ watch( { immediate: true } ) -// Check if any of the packs are currently being installed -const isInstalling = computed(() => { - if (!nodePacks?.length) return false - return nodePacks.some((pack) => managerStore.isPackInstalling(pack.id)) -}) - const getPackNodes = async (pack: components['schemas']['Node']) => { if (!pack.latest_version?.version) return [] const nodeDefs = await getNodeDefs.call({ diff --git a/src/components/dialog/content/manager/packCard/PackCardFooter.vue b/src/components/dialog/content/manager/packCard/PackCardFooter.vue index 8bb4fdb78..06aa88627 100644 --- a/src/components/dialog/content/manager/packCard/PackCardFooter.vue +++ b/src/components/dialog/content/manager/packCard/PackCardFooter.vue @@ -22,7 +22,6 @@