From 12dc9285f6458aae422426f3bb518dc501b36e23 Mon Sep 17 00:00:00 2001 From: master <> Date: Sun, 29 Mar 2026 13:41:49 +0300 Subject: [PATCH] Invalidate stale pack cache with old packId format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cache contained API responses with packId (old format) but the new mapper produces id. The store read these from cache, bypassing the API, and sortPacks filtered them out (no id field) → empty page. Fix: readCache() now detects stale entries (packId present, id missing) and clears them, forcing a fresh API fetch through the mapper. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../features/policy-studio/services/policy-pack.store.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Web/StellaOps.Web/src/app/features/policy-studio/services/policy-pack.store.ts b/src/Web/StellaOps.Web/src/app/features/policy-studio/services/policy-pack.store.ts index a2f2d9816..85db19320 100644 --- a/src/Web/StellaOps.Web/src/app/features/policy-studio/services/policy-pack.store.ts +++ b/src/Web/StellaOps.Web/src/app/features/policy-studio/services/policy-pack.store.ts @@ -98,7 +98,13 @@ export class PolicyPackStore { const raw = sessionStorage.getItem(this.cacheKey); if (!raw) return null; const parsed = JSON.parse(raw) as PolicyPackSummary[]; - return Array.isArray(parsed) && parsed.length > 0 ? parsed : null; + if (!Array.isArray(parsed) || parsed.length === 0) return null; + // Reject stale cache entries that have packId instead of id (old API format) + if (!parsed[0].id && (parsed[0] as any).packId) { + sessionStorage.removeItem(this.cacheKey); + return null; + } + return parsed; } catch { return null; }