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:
- Instance-level properties (this.cache)
- Static class properties (ClassName.cache)
- 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
apps/docs-angular/src/app/shared/docs-page/docs-page.component.ts
🔗 Related
- Decision ID:
dev_1769717312792_b93iifv - Session: 73
- Workspace: editor2
Auto-generated by MCP Smart Consolidation