Architecture: Angular effect() with showOverlay causing infinite re-execut...
Documentation for Sessions
🏗️ Architecture: Angular effect() with showOverlay causing infinite re-execut...
Date: 2026-01-29
Time: 15:29:29 UTC
Session: editor2-73.26
Agent: angular
Confidence: 98%
Status: ✅ Documented
📋 Decision Context
Question:
Angular effect() with showOverlay causing infinite re-execution and page freeze
Task: Not specified
🎯 Decision Made
Chosen:
Track overlay state to prevent duplicate calls
Options Considered:
- Remove message cycling from AppLoadingService
- Debounce showOverlay calls
- Track overlay state to prevent duplicate calls
- Move overlay logic outside effect
💭 Reasoning
CRITICAL PATTERN FOR @libs-ux/ux-loading: When using effect() with LoadingService.showOverlay(), NEVER read signals that change frequently (like cycling messages) in the same effect that calls showOverlay(). The showOverlay() method can create setIntervals internally. If the effect re-runs frequently, multiple intervals accumulate and freeze the browser. SOLUTION: Use a separate signal (_overlayShown) to track whether the overlay is already showing, and only call showOverlay() when transitioning from not-showing to showing. Read frequently-changing signals INSIDE the if-block after checking the guard condition.
📁 Files Involved
- No files specified
🔗 Related
- Decision ID:
dev_1769700569115_av3sb23 - Session: 73
- Workspace: editor2
Auto-generated by MCP Smart Consolidation