[Manager] Fix infinite fetch attempts when response is empty (#3392)

This commit is contained in:
Christian Byrne
2025-04-11 07:39:54 +08:00
committed by GitHub
parent c801a0c854
commit d687ea2cde
3 changed files with 20 additions and 12 deletions

View File

@@ -185,14 +185,16 @@ const {
startFetchInstalled, startFetchInstalled,
filterInstalledPack, filterInstalledPack,
installedPacks, installedPacks,
isLoading: isLoadingInstalled isLoading: isLoadingInstalled,
isReady: installedPacksReady
} = useInstalledPacks() } = useInstalledPacks()
const { const {
startFetchWorkflowPacks, startFetchWorkflowPacks,
filterWorkflowPack, filterWorkflowPack,
workflowPacks, workflowPacks,
isLoading: isLoadingWorkflow isLoading: isLoadingWorkflow,
isReady: workflowPacksReady
} = useWorkflowPacks() } = useWorkflowPacks()
const filterMissingPacks = (packs: components['schemas']['Node'][]) => const filterMissingPacks = (packs: components['schemas']['Node'][]) =>
@@ -236,7 +238,11 @@ watch([isInstalledTab, installedPacks], () => {
if (!isEmptySearch.value) { if (!isEmptySearch.value) {
displayPacks.value = filterInstalledPack(searchResults.value) displayPacks.value = filterInstalledPack(searchResults.value)
} else if (!installedPacks.value.length) { } else if (
!installedPacks.value.length &&
!installedPacksReady.value &&
!isLoadingInstalled.value
) {
startFetchInstalled() startFetchInstalled()
} else { } else {
displayPacks.value = installedPacks.value displayPacks.value = installedPacks.value
@@ -250,7 +256,11 @@ watch([isMissingTab, isWorkflowTab, workflowPacks], () => {
displayPacks.value = isMissingTab.value displayPacks.value = isMissingTab.value
? filterMissingPacks(filterWorkflowPack(searchResults.value)) ? filterMissingPacks(filterWorkflowPack(searchResults.value))
: filterWorkflowPack(searchResults.value) : filterWorkflowPack(searchResults.value)
} else if (!workflowPacks.value.length) { } else if (
!workflowPacks.value.length &&
!isLoadingWorkflow.value &&
!workflowPacksReady.value
) {
startFetchWorkflowPacks() startFetchWorkflowPacks()
} else { } else {
displayPacks.value = isMissingTab.value displayPacks.value = isMissingTab.value

View File

@@ -12,10 +12,8 @@ export const useInstalledPacks = (options: UseNodePacksOptions = {}) => {
Array.from(comfyManagerStore.installedPacksIds) Array.from(comfyManagerStore.installedPacksIds)
) )
const { startFetch, cleanup, error, isLoading, nodePacks } = useNodePacks( const { startFetch, cleanup, error, isLoading, nodePacks, isReady } =
installedPackIds, useNodePacks(installedPackIds, options)
options
)
const filterInstalledPack = (packs: components['schemas']['Node'][]) => const filterInstalledPack = (packs: components['schemas']['Node'][]) =>
packs.filter((pack) => comfyManagerStore.isPackInstalled(pack.id)) packs.filter((pack) => comfyManagerStore.isPackInstalled(pack.id))
@@ -27,6 +25,7 @@ export const useInstalledPacks = (options: UseNodePacksOptions = {}) => {
return { return {
error, error,
isLoading, isLoading,
isReady,
installedPacks: nodePacks, installedPacks: nodePacks,
startFetchInstalled: startFetch, startFetchInstalled: startFetch,
filterInstalledPack filterInstalledPack

View File

@@ -62,10 +62,8 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
Array.from(packsToUniqueIds(workflowPacks.value)) Array.from(packsToUniqueIds(workflowPacks.value))
) )
const { startFetch, cleanup, error, isLoading, nodePacks } = useNodePacks( const { startFetch, cleanup, error, isLoading, nodePacks, isReady } =
workflowPacksIds, useNodePacks(workflowPacksIds, options)
options
)
const isIdInWorkflow = (packId: string) => const isIdInWorkflow = (packId: string) =>
workflowPacksIds.value.includes(packId) workflowPacksIds.value.includes(packId)
@@ -80,6 +78,7 @@ export const useWorkflowPacks = (options: UseNodePacksOptions = {}) => {
return { return {
error, error,
isLoading, isLoading,
isReady,
workflowPacks: nodePacks, workflowPacks: nodePacks,
startFetchWorkflowPacks: startFetch, startFetchWorkflowPacks: startFetch,
filterWorkflowPack filterWorkflowPack