[debug] Conflict detection debugging (#4577)

This commit is contained in:
Jin Yi
2025-07-29 17:30:47 +09:00
committed by GitHub
parent c1577aac48
commit b7c43707d3
3 changed files with 22 additions and 53 deletions

View File

@@ -146,7 +146,6 @@ import { usePackUpdateStatus } from '@/composables/nodePack/usePackUpdateStatus'
import { useWorkflowPacks } from '@/composables/nodePack/useWorkflowPacks'
import { useConflictBannerState } from '@/composables/useConflictBannerState'
import { useRegistrySearch } from '@/composables/useRegistrySearch'
import { useComfyRegistryService } from '@/services/comfyRegistryService'
import { useComfyManagerStore } from '@/stores/comfyManagerStore'
import { useComfyRegistryStore } from '@/stores/comfyRegistryStore'
import type { TabItem } from '@/types/comfyManagerTypes'
@@ -160,7 +159,6 @@ const { initialTab } = defineProps<{
const { t } = useI18n()
const comfyManagerStore = useComfyManagerStore()
const { getPackById } = useComfyRegistryStore()
const registryService = useComfyRegistryService()
const conflictBannerState = useConflictBannerState()
const persistedState = useManagerStatePersistence()
const initialState = persistedState.loadStoredState()
@@ -480,56 +478,11 @@ whenever(selectedNodePack, async () => {
// Only fetch if we haven't already for this pack
if (lastFetchedPackId.value === pack.id) return
let data = null
// For installed nodes only, fetch version-specific information
if (comfyManagerStore.isPackInstalled(pack.id)) {
const installedPack = comfyManagerStore.getInstalledPackByCnrId(pack.id)
if (installedPack?.ver) {
// Fetch information for the installed version
data = await registryService.getPackByVersion(pack.id, installedPack.ver)
// Race condition check: ensure selected pack hasn't changed during async operation
if (selectedNodePack.value?.id !== pack.id) {
return
}
}
}
// For uninstalled nodes or if version-specific data fetch failed, use default API
if (!data) {
data = await getPackById.call(pack.id)
}
// Race condition check: ensure selected pack hasn't changed during async operations
if (selectedNodePack.value?.id !== pack.id) {
return
}
const data = await getPackById.call(pack.id)
// If selected node hasn't changed since request, merge registry & Algolia data
const isNodeData = data && 'id' in data && data.id === pack.id
const isVersionData = data && 'node_id' in data && data.node_id === pack.id
if (isNodeData || isVersionData) {
if (data?.id === pack.id) {
lastFetchedPackId.value = pack.id
// Merge API data first, then pack data (API data takes priority)
const mergedPack = merge({}, data, pack)
// Ensure compatibility fields from API data take priority
if (data?.supported_os !== undefined) {
mergedPack.supported_os = data.supported_os
}
if (data?.supported_accelerators !== undefined) {
mergedPack.supported_accelerators = data.supported_accelerators
}
if (data?.supported_comfyui_version !== undefined) {
mergedPack.supported_comfyui_version = data.supported_comfyui_version
}
if (data?.supported_comfyui_frontend_version !== undefined) {
mergedPack.supported_comfyui_frontend_version =
data.supported_comfyui_frontend_version
}
const mergedPack = merge({}, pack, data)
// Update the pack in current selection without changing selection state
const packIndex = selectedNodePacks.value.findIndex(
(p) => p.id === mergedPack.id

View File

@@ -1,5 +1,5 @@
import { useEventListener, whenever } from '@vueuse/core'
import { pickBy } from 'lodash'
import { mapKeys, pickBy } from 'lodash'
import { Ref, computed, ref } from 'vue'
import { app } from '@/scripts/app'
@@ -90,7 +90,15 @@ export const useManagerQueue = (
taskHistory.value = filterHistoryByClientId(state.history)
if (state.installed_packs) {
installedPacks.value = state.installed_packs
// The keys are 'cleaned' by stripping the version suffix.
// The pack object itself (the value) still contains the version info.
const packsWithCleanedKeys = mapKeys(
state.installed_packs,
(_value, key) => {
return key.split('@')[0]
}
)
installedPacks.value = packsWithCleanedKeys
}
updateProcessingState()
}

View File

@@ -1,4 +1,5 @@
import { whenever } from '@vueuse/core'
import { mapKeys } from 'lodash'
import { defineStore } from 'pinia'
import { v4 as uuidv4 } from 'uuid'
import { ref, watch } from 'vue'
@@ -167,7 +168,14 @@ export const useComfyManagerStore = defineStore('comfyManager', () => {
const refreshInstalledList = async () => {
const packs = await managerService.listInstalledPacks()
if (packs) installedPacks.value = packs
if (packs) {
// The keys are 'cleaned' by stripping the version suffix.
// The pack object itself (the value) still contains the version info.
const packsWithCleanedKeys = mapKeys(packs, (_value, key) => {
return key.split('@')[0]
})
installedPacks.value = packsWithCleanedKeys
}
isStale.value = false
}