Browse Source

fix:解决sim卡管理界面请求失败的项不重新请求的问题。

Jerry Liang 1 month ago
parent
commit
bb916a716a
1 changed files with 6 additions and 2 deletions
  1. 6 2
      src/views/sim-card-manage/useSimCardMonthlyCache.ts

+ 6 - 2
src/views/sim-card-manage/useSimCardMonthlyCache.ts

@@ -193,12 +193,16 @@ function onPageChange(simCards: SimCardInfo[]) {
   // 递增版本号:正在跑的循环会在下一轮迭代感知到并切换到新队列
   currentVersion++
 
+  // 清空失败标记:每次重新查询/翻页/切回界面都给失败项一次重新请求的机会,
+  // 否则上一批失败的项会在当前会话内被永久跳过、一直显示 "-"。
+  failedSet.clear()
+
   // 重建队列
   fetchQueue = []
   for (const sim of simCards) {
     const key = cacheKey(sim.giccid, sim.month)
-    // 已缓存 / 正在请求 / 已知失败的都跳过,避免重复请求与无谓的重复失败
-    if (!memoryCache.has(key) && !loadingSet.has(key) && !failedSet.has(key)) {
+    // 已缓存 / 正在请求的跳过;失败项已随 failedSet.clear() 重置,会重新入队请求
+    if (!memoryCache.has(key) && !loadingSet.has(key)) {
       fetchQueue.push({ giccid: sim.giccid, month: sim.month })
     }
   }