Skip to content

Commit 973d767

Browse files
luke-mino-altherrclaudeDrJKL
authored
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 <[email protected]> Co-authored-by: Alexander Brown <[email protected]>
1 parent 259e956 commit 973d767

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/platform/assets/composables/useUploadModelWizard.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { computed, ref, watch } from 'vue'
44
import { st } from '@/i18n'
55
import type { AssetMetadata } from '@/platform/assets/schemas/assetSchema'
66
import { assetService } from '@/platform/assets/services/assetService'
7+
import { useAssetsStore } from '@/stores/assetsStore'
8+
import { useModelToNodeStore } from '@/stores/modelToNodeStore'
79

810
interface WizardData {
911
url: string
@@ -18,6 +20,8 @@ interface ModelTypeOption {
1820
}
1921

2022
export function useUploadModelWizard(modelTypes: Ref<ModelTypeOption[]>) {
23+
const assetsStore = useAssetsStore()
24+
const modelToNodeStore = useModelToNodeStore()
2125
const currentStep = ref(1)
2226
const isFetchingMetadata = ref(false)
2327
const isUploading = ref(false)
@@ -143,6 +147,19 @@ export function useUploadModelWizard(modelTypes: Ref<ModelTypeOption[]>) {
143147

144148
uploadStatus.value = 'success'
145149
currentStep.value = 3
150+
151+
// Refresh model caches for all node types that use this model category
152+
if (selectedModelType.value) {
153+
const providers = modelToNodeStore.getAllNodeProviders(
154+
selectedModelType.value
155+
)
156+
await Promise.all(
157+
providers.map((provider) =>
158+
assetsStore.updateModelsForNodeType(provider.nodeDef.name)
159+
)
160+
)
161+
}
162+
146163
return true
147164
} catch (error) {
148165
console.error('Failed to upload asset:', error)

0 commit comments

Comments
 (0)