mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
fix: Refresh model dropdowns after upload (#7232)
## Summary Model selection dropdowns now automatically refresh after uploading a new model, ensuring users see newly uploaded models immediately. ## Changes - **Cache Orchestration**: Upload wizard now refreshes model caches by coordinating between `modelToNodeStore` and `assetsStore` - **Smart Refetching**: Only refreshes node types that use the uploaded model category (e.g., uploading a checkpoint refreshes `CheckpointLoaderSimple` but not `LoraLoader`) - **Clean Architecture**: Stores remain decoupled - the upload wizard composable orchestrates the refresh logic ## Technical Details After successful upload, `useUploadModelWizard`: 1. Gets all node providers for the model type from `modelToNodeStore` 2. Calls `assetsStore.updateModelsForNodeType()` for each affected node type 3. Model dropdowns reactively update via Pinia store watchers ## Review Focus - Orchestration pattern in upload wizard keeps stores decoupled - Efficient cache invalidation - only refreshes affected node types --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Alexander Brown <drjkl@comfy.org>
This commit is contained in:
committed by
GitHub
parent
259e9563c8
commit
973d7678a1
@@ -4,6 +4,8 @@ import { computed, ref, watch } from 'vue'
|
||||
import { st } from '@/i18n'
|
||||
import type { AssetMetadata } from '@/platform/assets/schemas/assetSchema'
|
||||
import { assetService } from '@/platform/assets/services/assetService'
|
||||
import { useAssetsStore } from '@/stores/assetsStore'
|
||||
import { useModelToNodeStore } from '@/stores/modelToNodeStore'
|
||||
|
||||
interface WizardData {
|
||||
url: string
|
||||
@@ -18,6 +20,8 @@ interface ModelTypeOption {
|
||||
}
|
||||
|
||||
export function useUploadModelWizard(modelTypes: Ref<ModelTypeOption[]>) {
|
||||
const assetsStore = useAssetsStore()
|
||||
const modelToNodeStore = useModelToNodeStore()
|
||||
const currentStep = ref(1)
|
||||
const isFetchingMetadata = ref(false)
|
||||
const isUploading = ref(false)
|
||||
@@ -143,6 +147,19 @@ export function useUploadModelWizard(modelTypes: Ref<ModelTypeOption[]>) {
|
||||
|
||||
uploadStatus.value = 'success'
|
||||
currentStep.value = 3
|
||||
|
||||
// Refresh model caches for all node types that use this model category
|
||||
if (selectedModelType.value) {
|
||||
const providers = modelToNodeStore.getAllNodeProviders(
|
||||
selectedModelType.value
|
||||
)
|
||||
await Promise.all(
|
||||
providers.map((provider) =>
|
||||
assetsStore.updateModelsForNodeType(provider.nodeDef.name)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
} catch (error) {
|
||||
console.error('Failed to upload asset:', error)
|
||||
|
||||
Reference in New Issue
Block a user