Summary of What Needs to be Done
Add an LRU-style cap to the module-level prefetchCache Map in src/utils/routePrefetch.js. The cache grows without bound as users visit different routes — every unique route ever accessed is permanently retained. While clearPrefetchCache() exists, it is never called in production.
Changes
- Define MAX_PREFETCH_CACHE_SIZE = 10
- In prefetchRoute, before inserting a new entry, check if the cache is at capacity and evict the oldest entry (using Map's insertion-order iteration)
- This mirrors the LRU cap pattern already used in recommendationEngine.js
Impact
Severity: Low-Medium — Unbounded memory growth in long-running SPA sessions. Users who explore many routes accumulate many cached import promises in memory over time.
Please assign this task to me.
Summary of What Needs to be Done
Add an LRU-style cap to the module-level prefetchCache Map in src/utils/routePrefetch.js. The cache grows without bound as users visit different routes — every unique route ever accessed is permanently retained. While clearPrefetchCache() exists, it is never called in production.
Changes
Impact
Severity: Low-Medium — Unbounded memory growth in long-running SPA sessions. Users who explore many routes accumulate many cached import promises in memory over time.
Please assign this task to me.