Invalidate stale pack cache with old packId format
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user