fix: address CodeRabbit review comments

- Add early return in updateAssetInCache when cacheKey resolves to undefined
- Fix test to use mapped node type to properly validate array cache behavior

Amp-Thread-ID: https://ampcode.com/threads/T-019c0bac-2144-73cb-a8d5-45146d0c2db9
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Subagent 5
2026-01-29 13:36:46 -08:00
parent 0310dd6ec3
commit e10a127c93

View File

@@ -507,12 +507,13 @@ export const useAssetsStore = defineStore('assets', () => {
cacheKey?: string
) {
const category = cacheKey ? resolveCategory(cacheKey) : undefined
if (cacheKey && !category) return
const categoriesToCheck = category
? [category]
: Array.from(modelStateByCategory.value.keys())
for (const cat of categoriesToCheck) {
if (!cat) continue
const state = modelStateByCategory.value.get(cat)
if (!state?.assets) continue