Bugfix: How to fix Angular effect() causing browser freeze with Load...

Documentation for Sessions

🐛 Bugfix: How to fix Angular effect() causing browser freeze with Load...

Date: 2026-01-29
Time: 20:08:27 UTC
Session: editor2-73.32
Agent: angular
Confidence: 100%
Status: ✅ Documented


📋 Decision Context

Question:

How to fix Angular effect() causing browser freeze with LoadingOverlayService?

Task: Fix docs-angular browser freeze on root URL


🎯 Decision Made

Chosen:

Track overlay state with separate signal to prevent re-entry

Options Considered:

  1. Debounce the effect
  2. Track overlay state with separate signal to prevent re-entry
  3. Remove the effect entirely

💭 Reasoning

The AppComponent effect was reading appLoadingService.currentMessage() which cycles every 2.5s. Each cycle triggered showOverlay() which accumulated setInterval timers, consuming 100% CPU. The fix: add _overlayShown signal, call showOverlay() only when isLoading becomes true AND overlay not shown, call hideOverlay() only when isLoading becomes false AND overlay was shown. This prevents the effect from reacting to message changes.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation