Bugfix: Why does the Knowledge Graph component require manual userId...

Documentation for Sessions

🐛 Bugfix: Why does the Knowledge Graph component require manual userId...

Date: 2026-03-02
Time: 19:12:24 UTC
Session: gspace1-165.10
Agent: angular
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

Why does the Knowledge Graph component require manual userId input when the user context is already available in the header?

Task: Auto-populate userId in Knowledge Graph from BrainContextService


🎯 Decision Made

Chosen:

Inject BrainContextService into KnowledgeGraphComponent and auto-populate userId signal from brainCtx.selectedUserId() via effect. Auto-load graph on ngAfterViewInit when userId is available. Keep input field editable for admin user-switching.

Options Considered:

  1. Inject BrainContextService + auto-load (chosen)
  2. Remove userId field entirely (breaks admin use case)
  3. Use route param for userId (unnecessary complexity)

💭 Reasoning

The KnowledgeGraphComponent (apps/gograb-ai/src/app/pages/vitto-mind/knowledge-graph/) was created in Session 152 before the BrainContextService pattern was established in Session 164. It used a bare userId = signal('') requiring manual input. All other vitto-hub components (system-prompt-preview, identity-viewer, diary-viewer, memory-manager, trust-dashboard) already correctly use BrainContextService.selectedUserId(). Fix: inject BrainContextService, effect auto-populates userId, ngAfterViewInit auto-loads graph. The userId input field remains visible but auto-filled — admins can still override it to view another user's graph.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation