fix: 字典项为空时getDict方法无限调用接口((无奈兼容 不给字典item本来就是错误用法))

This commit is contained in:
dap 2024-12-11 22:12:13 +08:00
parent 7577f17dd9
commit 6183d22b20
2 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,10 @@
- 通用的vxe-table排序事件(排序逻辑改为在排序事件中处理而非在api处理) - 通用的vxe-table排序事件(排序逻辑改为在排序事件中处理而非在api处理)
**BUG FIXES**
- 字典项为空时getDict方法无限调用接口((无奈兼容 不给字典item本来就是错误用法))
# 1.1.3 # 1.1.3
**REFACTOR** **REFACTOR**

View File

@ -20,7 +20,14 @@ export function getDict(dictName: string): DictData[] {
}) })
.finally(() => { .finally(() => {
// 移除请求状态缓存 // 移除请求状态缓存
/**
* item为空的情况( item本来就是错误用法)
* if一直进入逻辑导致接口无限刷新
* dictList为空时
*/
if (dictList.length > 0) {
dictRequestCache.delete(dictName); dictRequestCache.delete(dictName);
}
}), }),
); );
} }
@ -42,7 +49,14 @@ export function getDictOptions(dictName: string): Option[] {
}) })
.finally(() => { .finally(() => {
// 移除请求状态缓存 // 移除请求状态缓存
/**
* item为空的情况( item本来就是错误用法)
* if一直进入逻辑导致接口五线刷新
* dictList为空时
*/
if (dictOptionList.length > 0) {
dictRequestCache.delete(dictName); dictRequestCache.delete(dictName);
}
}), }),
); );
} }