Bugfix: Why does ComputerUsePanelComponent throw NG0203 toObservable...
Documentation for Sessions
🐛 Bugfix: Why does ComputerUsePanelComponent throw NG0203 toObservable...
Date: 2026-03-02
Time: 21:47:06 UTC
Session: gspace1-165.15
Agent: angular
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
Why does ComputerUsePanelComponent throw NG0203 toObservable() injection context error?
Task: Fix NG0203 toObservable injection context error in ComputerUsePanelComponent
🎯 Decision Made
Chosen:
Replace toObservable(signal).pipe(debounceTime, distinctUntilChanged) with effect() + setTimeout debounce. Effects work in ngOnInit context, toObservable does not.
Options Considered:
- No alternatives documented
💭 Reasoning
toObservable() from @angular/core/rxjs-interop must be called within an injection context (constructor or field initializer). It was called inside setupNlDetection() which runs from ngOnInit() — outside injection context. The NG0203 error fires at runtime. Fix: replaced with effect({ allowSignalWrites: true }) which reads pendingGoals signal reactively, plus a 500ms setTimeout for debouncing. This is simpler, avoids the injection context requirement, and achieves the same result (watch signal → debounce → detect NL template match). Removed unused toObservable and distinctUntilChanged imports.
📁 Files Involved
libs/libs-ai/vitto-hub/src/lib/components/computer-use-panel/computer-use-panel.component.ts
🔗 Related
- Decision ID:
dev_1772488025954_4x58ngb - Session: 165
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation