Pattern: Where should content caches live in Angular components that ...

Documentation for Sessions

🎨 Pattern: Where should content caches live in Angular components that ...

Date: 2026-01-29
Time: 20:08:32 UTC
Session: editor2-73.33
Agent: angular
Confidence: 90%
Status: ✅ Documented


📋 Decision Context

Question:

Where should content caches live in Angular components that get destroyed/recreated?

Task: Fix circuit breaker triggering for index.mdc requests


🎯 Decision Made

Chosen:

Static class properties (ClassName.cache)

Options Considered:

  1. Instance-level properties (this.cache)
  2. Static class properties (ClassName.cache)
  3. External service with providedIn: root

💭 Reasoning

Instance-level caches are lost when Angular destroys and recreates a component (e.g., on route changes). This caused DocsPageComponent to lose its folderContentCache and make repeated HTTP requests, triggering the circuit breaker. Static properties persist across component instances. Note: static caches should have max size limits to prevent memory leaks.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation