fix: invalidate loader node dropdown cache after model asset deletion

When deleting a model asset (checkpoint, lora, etc.), the loader node
dropdowns now update correctly by invalidating the category-keyed cache.

- After deletion, check asset tags for model categories (checkpoints, loras, etc.)
- Call invalidateCategory() for each affected category
- Add tests for deletion invalidation behavior

Fixes the bug where deleted models still appeared in loader node dropdowns.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019c08a2-6a9f-770f-994c-ad79d515f6a1
This commit is contained in:
Subagent 5
2026-01-28 23:29:43 -08:00
parent 94928c4dd3
commit 6761964788

View File

@@ -293,6 +293,8 @@ describe('useMediaAssetActions', () => {
await actions.deleteAssets(modelAsset)
// Only 'checkpoints' has providers; 'models' tag should not trigger invalidation
expect(mockInvalidateModelsForCategory).toHaveBeenCalledTimes(1)
expect(mockInvalidateModelsForCategory).toHaveBeenCalledWith(
'checkpoints'
)